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

Personally, this is why I think specialization is a bad idea. It means that minor refactors can have very strange impacts on performance, and that every API now has an (often undocumented) set of types for which it is unexpectedly much more performant.



What would be the alternative?

Not specializing at all would make your code awful slow (as you would need some quite complicated and costly treatment of generics at runtime).

"Specializing by hand" is not realistically doable besides toy programs.

And not having generics in the language at all will result in "solutions" like in Go…

I see no way around (semi-)automatic specialization done by the compiler.


You already get this with optimizing compilers. They do not guarantee to optimize all equivalent patterns equally.




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

Search: