Hacker News new | past | comments | ask | show | jobs | submit login

I think it's more accurate to say that there's an optimization that applies only to a very specific situation that's millions of times faster than without the optimization.

It's a bit strange to say that before the u8 specialization this was not a problem and it's suddenly a problem now.




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.


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?


I expect the special case handling for u8 to also apply to types that are just a strong typedef around u8.


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.


A "strong typedef" is not a typedef.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: