4 ms·
I am very curious about "zero-cost" here? Is this some standard technical term in the rust space?
by chrsjxn 4y ago
I am very curious about "zero-cost" here? Is this some standard technical term in the rust space?
- steveklabnik 4y agoIt’s a term borrowed from C++, a “zero cost abstraction.” Some folks use “zero overhead abstraction” to try and make the concept a bit more clear, since everything has some cost somewhere. “Zero cost” can feel incorrect.
- chrsjxn 4y agoThat makes more sense. Thanks! Creating and adding DOM nodes is definitely not free, but I can see how this is very low overhead compared to VDOM diffing.
- steveklabnik 4y agoNo problem. Here's the primary source, by the way: https://isocpp.org/wiki/faq/big-picture#zero-overhead-principle https://isocpp.org/wiki/faq/big-picture#zero-overhead-princi... > What you don’t use, you don’t pay for (in time or space) and further: What you do use, you couldn’t hand code any better.
- boredumb 4y agoYes. It's highlighted a lot in rust to mean zero cost abstraction. Basically adding language features without a run time penalty.
- twic 4y agoThe term comes from C++, where it does have a fairly rigorous definition: https://en.cppreference.com/w/cpp/language/Zero-overhead_principle https://en.cppreference.com/w/cpp/language/Zero-overhead_pri... Although: https://www.youtube.com/watch?v=rHIkrotSwcc https://www.youtube.com/watch?v=rHIkrotSwcc I'm not sure whether Rust people consistently use it with precisely the same sense.