3 ms·
It isn’t even zero runtime cost abstraction though. Monomorphizing all generic functions increases code size. Increased code size causes more instruction cache
by chongli 6y ago
It isn’t even zero runtime cost abstraction though. Monomorphizing all generic functions increases code size. Increased code size causes more instruction cache pressure which may actually slow things down, depending on the application. I could imagine if you’ve got some very large functions that are called on a wide variety of objects then every call could blow out the Icache and kill the hit rate.
- ben0x539 6y agoIt's an abstraction over writing out the monomorphized version by hand. Zero-cost doesn't mean using the abstraction gets you the fastest possible implementation of whatever you're doing.