[libcxx-commits] [libcxx] [libc++][print] Includes <format>. (PR #76333)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 26 04:11:45 PST 2024
zmodem wrote:
We noticed in Chromium that this grew our preprocessed compiler input size by ca 4.3 GB (1.2%).
A small example:
```
$ cat /tmp/a.cc
#include <iostream>
int main() {
std::cout << "Hello, world!\n";
return 0;
}
# Before this change:
$ build2/bin/clang++ -E -stdlib=libc++ -std=c++20 /tmp/a.cc | wc --bytes
3108703
$ perf stat -r20 build2/bin/clang++ -c -stdlib=libc++ -std=c++20 /tmp/a.cc
0.879287 +- 0.000996 seconds time elapsed ( +- 0.11% )
# After this change:
$ build2/bin/clang++ -E -stdlib=libc++ -std=c++20 /tmp/a.cc | wc --bytes
3683481
$ perf stat -r20 build2/bin/clang++ -c -stdlib=libc++ -std=c++20 /tmp/a.cc
0.98528 +- 0.00192 seconds time elapsed ( +- 0.20% )
```
That is an 18% increase in preprocessed size and 12% increase in compile time.
I realize this kind of change is driven by the standard, but is there anything that could be done to limit the negative impact, especially for those not using std::printf in this case?
(Yes, modules is the long-term answer, but many of us are not ready yet.)
https://github.com/llvm/llvm-project/pull/76333
More information about the libcxx-commits
mailing list