4 ms·
Seems obvious; like, did someone expect all the extra abstraction would make Go faster?
by kevwil 5y ago
Seems obvious; like, did someone expect all the extra abstraction would make Go faster?
- __s 5y agoWhat extra abstraction? I'd expect without monomorphization the code should perform the same as interface{} code, perhaps minus type cast error handling overhead. That's the model where generics are passing interface{} underneath, & exist only as a type check (à la Java type erasure)
- throwaway894345 5y agoThe article articulates why it's reasonable to expect that generics would make Go faster. From TFA: > Monomorphization is a total win for systems programming languages: it is, essentially, the only form of polymorphism that has zero runtime overhead, and often it has negative performance overhead. It makes generic code faster.
- anonymoushn 5y agoYes? We used code generators to monomorphize our code in like 2015 and it was faster than using interfaces. Generics could reasonably produce the same code we did in 2015, but they don't.