-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use parallel-hashmap #2462
base: master
Are you sure you want to change the base?
use parallel-hashmap #2462
Conversation
46ee7de
to
0cc8c3b
Compare
0cc8c3b
to
ef2fc83
Compare
Interesting, can you make this a build configuration option instead? Since this is a header-only library, just passing the path to its include directory should be sufficient. Either as a CMAKE custom variable (e.g. |
How does this compare against std::flat_map? I would like to avoid adding a Git submodule since it breaks tarball downloads and is annoying in general. I think a FetchContent download would be better. I also wouldn't like a build configuration option, because it creates another code variant to test. |
Point taken. I would still welcome a configuration option that allows us to pass the path of the phashmap include directory, and thus avoid a network download, as this will greatly simplify our CI builder configurations (just like with do for GoogleTest currently :-)). How do you plan to implement FetchContent in Regarding For Ninja, we have build plans with 900,000+ nodes in them, and the map are mutated in several places that can be distant in time (e.g. when dynamic dependencies are injected in it), so I don't think this type is a good fit here. Plus we don't need the ordering guarantee and the associated cost. |
Hmm, for source code tarball we may do something like this with another tarball containing submodule too. We can still use FetchContent and have similar functionality in configure.py, but showing caution in release page might be simpler? |
I suggest keeping things simple here:
|
This implements option 1 in ninja-build#2462 (comment). This uses https://github.com/greg7mdp/parallel-hashmap instead of unordered_map for faster ninja execution. Some more context is in https://crbug.com/346910589. This makes noop build for chromium * 12% faster on Linux * 2% slower on Windows * 96% faster on macOS ``` $ hyperfine --warmup 1 \ '~/ninja_master -C out/non_component build:buildflag_header_h' \ '~/ninja_faster_hash -C out/non_component build:buildflag_header_h' Benchmark 1: ~/ninja_master -C out/non_component build:buildflag_header_h Time (mean ± σ): 5.251 s ± 0.027 s [User: 4.641 s, System: 0.608 s] Range (min … max): 5.222 s … 5.309 s 10 runs Benchmark 2: ~/ninja_faster_hash -C out/non_component build:buildflag_header_h Time (mean ± σ): 4.689 s ± 0.022 s [User: 4.055 s, System: 0.633 s] Range (min … max): 4.648 s … 4.737 s 10 runs Summary ~/ninja_faster_hash -C out/non_component build:buildflag_header_h ran 1.12 ± 0.01 times faster than ~/ninja_master -C out/non_component build:buildflag_header_h ``` ``` Benchmark 1: C:\Users\tikuta\source\repos\ninja-build\ninja\ninja_master -C out/non_component build:buildflag_header_h Time (mean ± σ): 13.161 s ± 0.105 s [User: 10.657 s, System: 2.194 s] Range (min … max): 13.005 s … 13.328 s 10 runs Benchmark 2: C:\Users\tikuta\source\repos\ninja-build\ninja\ninja_faster_hash -C out/non_component build:buildflag_header_h Time (mean ± σ): 13.206 s ± 0.210 s [User: 10.653 s, System: 2.194 s] Range (min … max): 12.951 s … 13.578 s 10 runs Summary C:\Users\tikuta\source\repos\ninja-build\ninja\ninja_master -C out/non_component build:buildflag_header_h ran 1.00 ± 0.02 times faster than C:\Users\tikuta\source\repos\ninja-build\ninja\ninja_faster_hash -C out/non_component build:buildflag_header_h ``` ``` $ hyperfine --warmup 1 '~/ninja_master -C out/non_component build:buildflag_header_h' '~/ninja_faster_hash -C out/non_component build:buildflag_header_h' Benchmark 1: ~/ninja_master -C out/non_component build:buildflag_header_h Time (mean ± σ): 14.360 s ± 0.706 s [User: 9.006 s, System: 1.681 s] Range (min … max): 12.832 s … 15.297 s 10 runs Benchmark 2: ~/ninja_faster_hash -C out/non_component build:buildflag_header_h Time (mean ± σ): 7.340 s ± 0.260 s [User: 6.263 s, System: 0.828 s] Range (min … max): 6.948 s … 7.799 s 10 runs Summary ~/ninja_faster_hash -C out/non_component build:buildflag_header_h ran 1.96 ± 0.12 times faster than ~/ninja_master -C out/non_component build:buildflag_header_h ```
This makes noop build time around 12% faster in chromium.
TODO: get benchmark resulsts from hyperfine