mcy / best

The Best Library: a C++ STL replacement
Apache License 2.0
165 stars 2 forks source link

Improve compile times #17

Closed mcy closed 4 months ago

mcy commented 4 months ago

This change improves cold compilation of best's test suite from 8.296s to 6.030s on my machine, representing a 37% speedup. //best/container:span_test, my primary micro-benchmark whose timings I used to find optimization opportunities, went from 6.5s to 4.0s seconds as measured by Bazel.

To effect this change, I've made several optimizations that fall into the following categories:

There is probably more, but I'm satisfied for now. NB: I used bazel build --subcommands to extract a single clang call of interest, then ran time <clang command> -ftime-trace -ftime-trace-granularity=1 to get a flame graph of compilation time expenditure.