Extra mv in filter-showIncludes.awk?

Michael Stahl mstahl at redhat.com
Thu Jan 22 07:02:39 PST 2015


On 22.01.2015 15:31, Ashod Nakashian wrote:
> 
> I've done some profiling of LO build and one of the common events is the
> spawning of bash and mv (on cygwin).
> Another performance investigation (deps and pch) took me
> to filter-showIncludes.awk where I found the source of the thousands of
> mv spawns.
> 
>     close(tempfile)
>     movecmd = "mv " tempfile " " depfile
>     ret = system(movecmd)
> 
> It seems that filter-showIncludes.awk is writing the dependency file .d
> in a .tmp file first, then it's renaming it to .d.
> Considering that the input is piped from stdin and .d either doesn't
> exist or will be overwritten (and is never an input,) the wisdom of
> writing to a temp file and then moving is lost on me.

the point is to have an atomic update of the make target, i.e. if the
build is interrupted for whatever reason, prevent an incompletely
written .d file with up-to-date time stamp that will very likely break
the next build.

> A complete build generates close to 9000 .d files in CxxObject alone.
> Spawning processes and doing file I/O in the several thousands are bound
> to have a toll.

sure but filter-showIncludes is only run when the C++ compiler is also
run on the file and that will take a lot longer than forking a "mv" process.




More information about the LibreOffice mailing list