[libcxx-commits] [libcxx] [libc++] Granularize <vector> (PR #99705)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 4 01:21:02 PDT 2024


philnik777 wrote:

> > > What is the motivation for this patch?
> > 
> > 
> > It allows reducing the compilation times for `<vector>` which spiked after we introduced the formatters.
> > When we introduced formatters, we got many reports of people finding their compilation times and preprocessed file sizes regressed by a huge amount. That was tracked down to the fact that `<vector>` was now including a bunch of stuff for `<format>`. By splitting up `<vector>` into subparts like this, other parts of the library can include only the parts that they actually need.
> 
> Thanks for the context. I would appreciate it if the commit message incorporated this information, as it isn't currently clear why this change is important.
> 
> > FWIW, I think we could potentially get away with a less granular split. For example, we could only extract the formatters in one header and have everything else in another header, both of which would be included from `<vector>`. If we want to split `vector` and `vector<bool>`, we have to have comparison operators, `swap` and `remove` in a shared location too. We could maybe do `__vector/common.h`?
> 
> I'd appreciate seeing the results of an A/B experiment before splitting out `vector<bool>` into its own file (as well as generally understanding how we're benchmarking this). I'd also like to see this information into the commit message, or mentioning an associated GH issue in the commit message that documents the results and processed.

Splitting out `vector<bool>` reduces the include times of `<functional>` by ~18ms. I'm getting the numbers through `-ftime-trace`.

https://github.com/llvm/llvm-project/pull/99705


More information about the libcxx-commits mailing list