*tl;dr; set enable_precompiled_headers = true* (why isn't this the
default?!)

Maybe this is a Windows only issue...

but compilation has been painfully slow for me when changing the slightest
thing in v8. I attributed this to v8's apparent preference for inlining the
majority of the code in headers.

Recently I enabled ninja's build summary (NINJA_SUMMARIZE_BUILD=1 and
optionally NINJA_STATUS=[%r processes, %f/%t @ %o/s : %es ] -- it's
awe-so-me!) and was baffled that it takes 3 minutes on a Z840 to
build value-serializer-unittest.obj..!

Looking at it I noticed it uses huge inline headers. Dug for a better GN
option for headers and found "enable_precompiled_headers" :).

With it my build went from:

    Longest build steps:
           0.7 weighted s to build
obj/test/unittests/unittests_sources/asm-types-unittest.obj (11.7 s CPU
time)
           1.0 weighted s to build
obj/test/unittests/unittests_sources/machine-operator-reducer-unittest.obj
(14.4 s CPU time)
           1.4 weighted s to build
obj/test/unittests/unittests_sources/eh-frame-writer-unittest.obj (17.4 s
CPU time)
           1.8 weighted s to build
obj/test/unittests/unittests_sources/functional-unittest.obj (19.4 s CPU
time)
           1.8 weighted s to build
obj/test/unittests/unittests_sources/function-body-decoder-unittest.obj
(19.5 s CPU time)
           2.6 weighted s to build
obj/test/unittests/unittests_sources/bytecode-source-info-unittest.obj
(22.9 s CPU time)
           3.4 weighted s to build unittests.exe, unittests.exe.pdb (3.4 s
CPU time)
           3.5 weighted s to build
obj/test/unittests/unittests_sources/bytecodes-unittest.obj (25.5 s CPU
time)
           9.6 weighted s to build
obj/test/unittests/unittests_sources/decoder-unittest.obj (37.7 s CPU time)
         154.8 weighted s to build
obj/test/unittests/unittests_sources/value-serializer-unittest.obj (182.9 s
CPU time)
    Time by build-step type:
           0.1 s weighted time to generate 1 .stamp files (0.1 s CPU time)
           3.4 s weighted time to generate 1 PEFile (linking) files (3.4 s
CPU time)
         182.9 s weighted time to generate 31 .obj files (519.8 s CPU time)
    186.4 s weighted time (523.3 s CPU time, 2.8x parallelism)
    33 build steps completed, average of 0.18/s

to:

        Longest build steps:
           0.1 weighted s to build obj/v8_base/wasm-module.obj (6.0 s CPU
time)
           0.2 weighted s to build
obj/test/unittests/unittests_sources/scheduler-rpo-unittest.obj (2.7 s CPU
time)
           1.3 weighted s to build
obj/v8_base/scanner-character-streams.obj (9.7 s CPU time)
           3.2 weighted s to build
obj/v8_base/ast-function-literal-id-reindexer.obj (14.0 s CPU time)
           3.2 weighted s to build unittests.exe, unittests.exe.pdb (3.2 s
CPU time)
           3.4 weighted s to build obj/v8_base/concurrent-marking.obj (14.2
s CPU time)
           4.5 weighted s to build gen/snapshot.cc, snapshot_blob.bin (4.5
s CPU time)
           8.9 weighted s to build v8_for_testing.dll,
v8_for_testing.dll.lib, v8_for_testing.dll.pdb (20.0 s CPU time)
          14.2 weighted s to build
obj/test/unittests/unittests_sources/decoder-unittest.obj (25.5 s CPU time)
          20.7 weighted s to build mksnapshot.exe, mksnapshot.exe.pdb (20.7
s CPU time)
    Time by build-step type:
           0.4 s weighted time to generate 9 .stamp files (0.8 s CPU time)
           4.5 s weighted time to generate 1 .bin files (4.5 s CPU time)
          30.8 s weighted time to generate 449 .obj files (1442.5 s CPU
time)
          32.8 s weighted time to generate 3 PEFile (linking) files (43.9 s
CPU time)
    68.6 s weighted time (1491.7 s CPU time, 21.7x parallelism)
    462 build steps completed, average of 6.73/s

Woohoo!
Gab

PS: Now I'm puzzled as to why this isn't the default...

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to