5 ms·
I think the conclusion, about Rust having zero-cost abstractions, is completely wrong. The before code and the after code are functionally equivalent. Find all
by jonstewart 3y ago
I think the conclusion, about Rust having zero-cost abstractions, is completely wrong. The before code and the after code are functionally equivalent. Find all the matches, do some checking, select all of them — if Rust’s abstractions were zero-cost, the performance differences between the versions would be negligible.
Obviously, it’s a straw man argument for me to make about the zero-cost abstraction claim. But the point here, about which the blog is curiously silent, is that contemporary CPUs are fickle beasts, and they can run 250X faster, without resorting to exotic techniques, if you structure your code just so. This is the complete opposite of the zero-cost abstraction claim, which I don’t mean to be pedantic about, but is worth stating bald-faced because it’s what performance engineers have learned, that the answer is always “it depends.”