gn generates huge .ninja files for static library builds, due to filesize being superlinear in number of object files in that case |
||
Issue descriptionRunning `time caffeinate ninja -C out/gn/ obj/v8/v8_base/source-position.o` takes twice as long for empty builds in static library builds compared to component builds (on my laptop, 1.2s vs 0.6s -- the latter is fast enough, the former isn't). `find out/gn/ -name '*.ninja' -print0 | xargs -0 wc -c | sort -n` says that gn generates 30MB of ninja files for component builds, but 50MB for static library builds. Looking at the generated ninja files, this is mostly due to source_set()s having an O(n^2) effect on output file size: every test target depending on chrome lists all object files belonging to chrome on its link line. One approach to fix this could be to give source_sets a "link" step that just produces a txt file listing all the .o files part of that source_set, and then pass that to the linker via @ or -filelist (on mac) -- that way, the list of object files of chrome are listed just once and not repeated for every target depending on chrome. This is not a problem in gyp because that uses static_libraries instead of source_sets.
,
May 23 2016
I've been meaning to fold the rules for groups into the main build file. I'd really like to fold everything in, but I can't put all binary targets into one ninja file because of Ninja's scoping rules (I started a thread about this on the Ninja list a few months ago).
,
May 23 2016
@brettw - your comment #2 only addresses comment #1, right? Having everything in one file wouldn't (IIUC) address the main problem thakis is talking about, right? -- Dirk
,
May 23 2016
Right, my response was just referring to Nico's "mostly empty ninja files" comment,
,
Aug 5 2016
This should be much better in practice now that most things are static_libraries instead of source_sets.
,
Aug 17 2016
I don't see an obvious way to change this more in the future. I'm going to close it. |
||
►
Sign in to add a comment |
||
Comment 1 by thakis@chromium.org
, May 23 2016