Re:When zero cost abstractions aren't zero cost
by ixtli on Monday August 09, 2021 @09:51PM
(#28124415)
Very well said. I actually came here to write a comment criticizing the post because the fact that this was “negative” has to do with the order in which the experiment took place. Flip it and you have a different sentiment. A similar point can be made but an explanation of “it’s very slow” presumes an assumption that every statement in rust will be maximally optimized via specialization which I consider to be an unreasonable expectation.
Re:When zero cost abstractions aren't zero cost
by throwaway17_17 on Monday August 09, 2021 @10:29PM
(#28124623)
I’m not arguing against you, but why do you feel like expecting maximal optimization is unreasonable? Is it just when limited to specialization or do you think it applies more broadly in terms of general optimization?
Re:When zero cost abstractions aren't zero cost
by hsn915 on Monday August 09, 2021 @10:01PM
(#28124465)
I expect the special case handling for u8 to also apply to types that are just a strong typedef around u8.
Re:When zero cost abstractions aren't zero cost
by bilkow on Tuesday August 10, 2021 @02:41AM
(#28125754)
Rust has "typedefs" and those are called type aliases.
The intention of the newtype pattern is to specifically create a new type without the behaviour of the wrapped type, so if there's a special case just for u8, I would expect it not to be on the newtype.
Re:When zero cost abstractions aren't zero cost
by jcranberry on Tuesday August 10, 2021 @04:14PM
(#28133763)
A "strong typedef" is not a typedef.
It's a bit strange to say that before the u8 specialization this was not a problem and it's suddenly a problem now.