5 ms·
I would prefer a "lightweight" C++. C++ is fine, but it's insanely slow to compile. I generally like C++, but I could trade anything to make it faster to comp
by jokoon 1y ago
I would prefer a "lightweight" C++.
C++ is fine, but it's insanely slow to compile.
I generally like C++, but I could trade anything to make it faster to compile, and most of the time, I just use a small subset of C++ that I feel okay with.
- pjmlp 1y agoPre-compiled headers, binary libraries, avoid header only libraries, if lucky to be on latest clang/VC++, modules.
- jokoon 1y agopch are not standard Modules support was added recently, and I don't think most libraries or cmake support it yet, and I don't really see tutorial about good practices for modules, especially when it comes down to speeding up compilation. Also modules do not really speed up compilation that much, apparently, or I have not seen benchmarks, maybe because modules are not well supported yet? Modules are great in theory, but I am not sure they are usable in 100% of cases, especially with all the existing code that is out there?
- SuperV1234 1y agoC++ is not slow to compile. The Standard Library is.
- lerno 1y agoC++ is just slow to compile. With the standard library it is much worse. The problem is that with C++ you're not getting as much encapsulation as you would in C unless you do extra work that also has a performance hit (pimpl). This means that C++ code often has to recompile a whole lot more than C code does when doing incremental compilation in my experience.
- SuperV1234 1y agoThis is just not true. There's nothing that makes C++ inherently slow to compile. PImpl doesn't need to have a performance hit as you can implement it with a local fixed-sized buffer that's not heap-allocated. You can also design your C++ codebase exactly as you would in C, so there's literally no reason why you'll need to recompile more in one language compared to the other.
- jokoon 1y agoC++ is not context free. A quick google "c++ grammar" will give you clues that C++ is not you average language. Templates are also turing complete, and probably not trivial to parse. Of course I am not talking about C++98, but C++14, 17, etc, which add significant stuff.