Skip to content

Comment on C++ Compilation Speedparent

Comments

Speed increases like those explained in http://www.tilander.org/aurora/2007/12/comparing-stdsort-and..., which compares qsort to std::sort.

Because templates are basically automated code copy-paste, the compiler can more easily inline at compile-time. Unfortunately, it also translates to lots more compiled code, which means slower compile times and fatter binaries. Still, writing something like the STL library in C with the same performance characteristics would be much more difficult, if not impossible.

I'm not a C++ expert, but that's my understanding of things, at least.

If you are worried about the performance hit caused by function calling through a function pointer you might want to give a look at http://sglib.sourceforge.net/.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.