New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 614077 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

gn generates huge .ninja files for static library builds, due to filesize being superlinear in number of object files in that case

Project Member Reported by thakis@chromium.org, May 23 2016

Issue description

Running `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.
 

Comment 1 by thakis@chromium.org, May 23 2016

(The `find` command also finds two completely empty .ninja files and quite a few that say only things like `build irt_x64/obj/base/base_paths.stamp: irt_x64_stamp` -- maybe these don't warrant being written to a separate file.)

Comment 2 by brettw@chromium.org, 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).
@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

Comment 4 by brettw@chromium.org, May 23 2016

Right, my response was just referring to Nico's "mostly empty ninja files" comment,
This should be much better in practice now that most things are static_libraries instead of source_sets.

Comment 6 by brettw@chromium.org, Aug 17 2016

Status: WontFix (was: Untriaged)
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