-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
chronoC++20 chronoC++20 chronoformatC++20/23 formatC++20/23 formatthroughputMust compile fasterMust compile faster
Description
On reddit, u/tgolyi reports:
std::format
is very cool, but why did you include<format>
to<chrono>
? This change alone slowed down compilation for our project by 20%. Is it required by the standard now to include<format>
(to supportstd::formatter
specialization)? It's just that<chrono>
is included by so many other headers like<mutex>
and<thread>
and Qt too.
Separately from any throughput improvements for <format>
, I believe it should be possible to remove this dependency:
Lines 37 to 40 in 4c862ee
#ifdef __cpp_lib_format | |
#include <format> | |
#include <iomanip> | |
#endif // defined(__cpp_lib_format) |
The fix would presumably involve some combination of:
- Forward declarations (of
formatter
etc.) - Extracting common machinery to a centralized header somewhere (used sparingly, since this costs throughput)
- Possibly templatizing stuff so that it isn't instantiated until needed (need to follow the Standard's lookup rules)
Related to DevCom-10046069 "Including chrono and compiling with -std:c++20 is ten time slower than before" and internal VSO-1543202 / AB#1543202 .
NN---, stevenhoving, mnatsuhara, naubryGV, jovibor and 3 more
Metadata
Metadata
Assignees
Labels
chronoC++20 chronoC++20 chronoformatC++20/23 formatC++20/23 formatthroughputMust compile fasterMust compile faster