3 ms·
As a previous compiler developer, its a pretty bad idea to look at the final lines of code to determine its cost. Typically in compiler development, there's ma
by filereaper 9y ago
As a previous compiler developer, its a pretty bad idea to look at the final lines of code to determine its cost.
Typically in compiler development, there's massive R&D time, many hours spent analyzing memory & CPU patterns to figure out which code to emit. You also take a look at disassembly of generated code and nowdays perform data-mining to figure out which patterns of optimize for (typically on non-kernel or hotspot-heavy type workloads).
The end result of alot of investigation can be few lines of code which have to be absolutely robust and production ready at the time of release under standard configurations (i.e -O1, -O2 etc...)
Its a costly piece of engineering which is why some companies still charge money for it.
I'd say the article's estimates are accurate for a simple compiler that emits results at say -O0 or -O1 level of efficiency, but anything higher will start to require more and more resources with diminishing gains over time. But this can be said about most things in engineering.