3 ms·
Learning C++ is easy. What's hard is being able to afford a computer that can compile it in a reasonable amount of time. I've seen projects written in C / Asse
by jart 7y ago
Learning C++ is easy. What's hard is being able to afford a computer that can compile it in a reasonable amount of time.
I've seen projects written in C / Assembly that build over 9,000 objects in about 20 seconds on just one PC, whereas more than a few C++ codebases I've seen in the past couple years, that can be about as long as it takes to build just one file.
I honestly suspect the only folks really writing C++ consistently these days, on things like LLVM, are the ones who work at huge companies, with literal supercomputers devoted to compiling their code, which would prevent them from ever encountering the latency issues that exclude poor folk such as myself from any hope of ever hacking on their codebase. It's sort of like that scene of Agent Smith talking to Neo in the interrogation room: "What good is the source code... if you're unable to build?"
- kvakil 7y agoMaybe take a look at gg [0]? It seems to solve the problem of slow compilation quite nicely. [0] https://github.com/StanfordSNR/gg https://github.com/StanfordSNR/gg
- TazeTSchnitzel 7y agoWhy should I have to outsource compilation to Someone Else's Computer?
- pjmlp 7y agoVisual C++ with pre-compiled headers, incremental compilation and linking turned on, does a pretty good job. https://devblogs.microsoft.com/cppblog/improved-linker-fundamentals-in-visual-studio-2019/ https://devblogs.microsoft.com/cppblog/improved-linker-funda... Another tip, use binary libraries and don't build everything from scratch. Modularize the application into their own libraries as well. Speaking of modules, they are part of C++20, with VC++ and clang adapting their implementations, gcc ramping up its implementation, and everyone else that cares about ISO C++20 also ramping up theirs. Fun fact, Swift and Rust codebases aren't that fast to compile when compared against C++ code that isn't doing any crazy template metaprogramming.
- shaklee3 7y agoAre there languages that have powerful template metaprogramming that are much faster to compile?