4 ms·
This is a fairly common optimization that is normally performed by the linker. [0] is a blog entry that describes Microsoft’s implementation of identical functi
by tjalfi 8y ago
This is a fairly common optimization that is normally performed by the linker. [0] is a blog entry that describes Microsoft’s implementation of identical function merging.
[0] https://blogs.msdn.microsoft.com/oldnewthing/20050322-00/?p=36113 https://blogs.msdn.microsoft.com/oldnewthing/20050322-00/?p=...
Edited to add link.
- repsilat 8y agoOoh, really cool. The comment about function-pointer comparisons was a pretty funny ramification I hadn't considered too. Real "wtf" debugging case I bet. I wonder what the standard says about it, what the linker can/could typically prove is "safe", and what performance/size changes are seen in practice.
- tjalfi 8y agoThe paper Safe ICF in Gold[0] says that they get between 4 to 7% savings on code size. A safer version that omits functions that have their address taken was 97% as effective. The talk Diet Templates[1] has some suggestions for how to reduce template bloat. [0] https://ai.google/research/pubs/pub36912 https://ai.google/research/pubs/pub36912 [1] https://accu.org/content/conf2011/Jonathan-Wakely-diet-templates.pdf https://accu.org/content/conf2011/Jonathan-Wakely-diet-templ... Edited to add the second paragraph.