5 ms·
Every specialization of a template creates a new instance of it with new symbols. With heavily nested templating that can add up quite quickly. The most probl
by wheels 17y ago
Every specialization of a template creates a new instance of it with new symbols. With heavily nested templating that can add up quite quickly.
The most problematic case at my last company was where there were several hundred specializations (just one-liners) one after another in some of the error handling code. Each of those specialized several more templates. I managed to shave a few dozen MB off of the binary size (and remember, larger binaries == more cache pressure) by replacing the templates with a base class and virtual function.