Hacker News new | ask | show | jobs
by robryk 4367 days ago
There might actually be a performance cost due to increased code size (by way of increased amount of icache misses).
1 comments

The implementers of MLton, an ML compiler that does C++ style monomorphization, found that after optimization the code size is actually smaller with monomorphization. That's because the specialized code is simpler and can be further optimized. So even if you have multiple specialized copies, the total is still smaller. See here: http://mlton.org/Performance