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

Issue 855015 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

we build many copies of precompile_core.cc.obj

Project Member Reported by h...@chromium.org, Jun 21 2018

Issue description

As part of investigating compile times and PCH, I noticed we build the precompiled header object for blink many times:

$ find out/release -name precompile_core.cc.obj -exec sha1sum {} \;
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/bindings/core/v8/bindings_core_impl/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/offscreencanvas/offscreencanvas/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/probe/probe/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/fullscreen/fullscreen/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/intersection_observer/intersection_observer/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/fetch/fetch/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/exported/exported/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/frame/frame/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/style/rendering/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/style/svg_style/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/xml/xml/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/context_features/context_features/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/messaging/messaging/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/inspector/inspector/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/typed_arrays/typed_arrays/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/events/events/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/resize_observer/resize_observer/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/policy/policy/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/html/parser/parser/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/html/html/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/streams/streams/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/mojo/mojo/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/editing/editing/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/xmlhttprequest/xmlhttprequest/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/core/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/clipboard/clipboard/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/origin_trials/origin_trials/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/execution_context/execution_context/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/workers/workers/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/core_generated/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/script/script/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/imagebitmap/imagebitmap/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/dom/dom/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/paint/paint/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/geometry/geometry/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/animation/animation/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/page/page/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/timing/timing/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/url/url/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/input/input/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/svg/svg/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/fileapi/fileapi/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/css/css/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/loader/loader/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/layout/svg/svg_layout/precompile_core.cc.obj
01d2f4c696889439a2e1c6337f367625e47236dc  out/release/obj/third_party/blink/renderer/core/layout/layout/precompile_core.cc.obj

(That's 46 files.)

These are identical, and they're not copied around, each one is compiled individually.

The file is 7.6 MB large.

I don't know exactly how long each one takes to compile, but if we back-of-the-envelope estimate 10 s each, that's over 7 minutes of CPU time wasted.
 

Comment 1 by tikuta@chromium.org, Jun 22 2018

Cc: brettw@chromium.org tikuta@chromium.org dpranke@chromium.org
Labels: Build-Tools-GN
This requires GN side change?

Comment 2 by brettw@chromium.org, Jun 22 2018

Each target can have its own cflags, defines, include paths, etc. They could be set on the target or implicitly from the dependencies in lots of various way. Precompiled headers are sensitive to any of these changes.

So GN would have to compare all flags for these files to see which ones match, and then share the compilation from that. This adds quite a lot of complexity to the implementation. And currently there is no required serialization for writing the build files, so adding this check would serialize GN execution substantially.

So I don't think this is worth doing.

Comment 3 by brettw@chromium.org, Jun 22 2018

Also: when comparing, you need to compare the executed command lines, not the contents of the resulting files. It's quite possible that some of the files have slightly different command lines and so will need different precompiled header invocations. Since our system headers don't depend on most of the settings we supply, they'll always resolve to the same result, but the build can't know that.

Sign in to add a comment