3 ms·
The term "zero-cost abstraction" is a bit annoying. By definition an abstraction has an obfuscation and compilation cost even if it doesn't add to the runtime c
by zimbatm 10y ago
The term "zero-cost abstraction" is a bit annoying. By definition an abstraction has an obfuscation and compilation cost even if it doesn't add to the runtime cost. Too much of these and the program is not understandable anymore and takes hours to compile.
- staticassertion 10y agoZero cost abstraction has never meant anything other than 0 cost at runtime, so I don't see why you would get annoyed at it being used accuratcly.
- p0nce 10y agoI wish the term wouldn't exist. I've measured "zero-cost abstraction" that weren't quite so when profiled. What it really means is "if the inlining goes like the programmer expects, then it should have no cost". The term expresses hope. But inlining is best left to the compiler, and hope is of little value until measurement is done with a profiler.
- stymaar 10y agoInrust you can tell the compiler to always inline a given function.[1] But you don't necessarily want to do that since you may not make the most efficient use of the CPU cache. [1] https://doc.rust-lang.org/reference.html#inline-attributes https://doc.rust-lang.org/reference.html#inline-attributes