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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 1 09:34:57 PDT 2024


ldionne 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.

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`?

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


More information about the libcxx-commits mailing list