4 ms·
So why on earth is std::string so slow to compile, if it's possible to compile this full-featured formatting library in 1/4 of the time?
by widdershins 3y ago
So why on earth is std::string so slow to compile, if it's possible to compile this full-featured formatting library in 1/4 of the time?
- vitaut 3y agoAFAICS the main problem is that <string> pulls in a lot of dependencies.
- pjmlp 3y agoIt isn't when using modules, import std brings in the whole standard C++ faster than that #include. EDIT: This compiles in 1 second on an i7 laptop. import std; int main() { std::cout << "Hello World!\n"; }
- vitaut 3y agoUnfortunately the std module alone doesn't help much because 1 second is 3x slower than before the optimization described in the post but maybe more fine-grained modules will (or if std module import made faster).
- pjmlp 3y agoFor the whole library, everything. Also Microsof Office team has been migrating to modules, with great build improvements.
- za3faran 3y agoAny place where I can read up more about this?
- pjmlp 3y agohttps://devblogs.microsoft.com/cppblog/integrating-c-header-units-into-office-using-msvc-1-n/ https://devblogs.microsoft.com/cppblog/integrating-c-header-... https://devblogs.microsoft.com/cppblog/integrating-c-header-units-into-office-using-msvc-2-n/ https://devblogs.microsoft.com/cppblog/integrating-c-header-... Key takeway "Fortunately, we were able to show a build performance improvement great enough that the team agreed to adopt header units into the Office production build system alongside msvc 17.6.6!" Unfortunely the performance findings blogpost is still WIP.
- KingLancelot 3y ago[dead]
- OskarS 3y agoNot to be "that guy", but... one second is a VERY VERY long time to compile a hello world program.