And similarly, the fact that people think that register allocation is "zero cost" is another good example of why that phrase is bad. People should understand that there are currently either no or almost no truly "zero cost" abstractions.
-
-
We all understand that watching a movie on Netflix isn't "zero cost", but we don't all understand that using various modern language features isn't "zero cost", and we should. That's all.
-
An example of this: Someone tried this with rust (Which claims to have zero cost abstractions), found a bug in the compiler where a case is NOT zero cost https://www.joshmcguigan.com/blog/cost-of-indirection-rust/ … causing a substantial performance degradation (2x slower, seemingly due to cache misses)
- Show replies
New conversation -
-
-
That analogy makes sense to me. Indeed, in C++, "zero cost" usually means "you couldn't have written better C++ by hand", not "you couldn't have written better assembly by hand".
-
Again, just to be clear, _you could_ have written better C++ by hand. That was the point of the monomorphization - what the compiler generates is not as good as if you have manually written what you wanted, because you can make better "commonization" tradeoffs.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.