4 ms·
A lot of C++ compile time is simply generating and optimizing all the code. Modules don't help with this. Modern C++ style generally requires making a whole bu
by pcwalton 11y ago
A lot of C++ compile time is simply generating and optimizing all the code. Modules don't help with this.
Modern C++ style generally requires making a whole bunch of little functions and classes and counting on them to be inlined and SROA'd away. This works remarkably well for runtime, but it exacts a big compilation performance hit simply because you're optimizing so much code.
- aarongolliver 11y agoInteresting anecdote, I was writing a ray tracer recently and instead of using real recursion I tried using a recursive template instead (because who needs i-cache). Basically, every bounce of a ray was a different function with <current_bounce + 1> until <max_bounces>. The actual ray-tracing code wasn't that long at all, but if you turned max_max_bounces up (say, 100+) "code-gen" time in visual studio blew up to over one minute. That was the moment when I appreciated what everyone was saying about C++ compile times being quite slow if you (mis)use templates.