4 ms·
Not really fair. You could already get this performance, when you cared, by writing the specialized datastructure for the specific types you cared about. So sur
by dilap 5y ago
Not really fair. You could already get this performance, when you cared, by writing the specialized datastructure for the specific types you cared about. So sure, generics let you write type-agnostic libraries that don't pay a boxing/unboxing penalty, but that's not really news!
- snovv_crash 5y agoI do a lot with specialized data structures for things like kNN or sparse adjacency matrices, in multiple different contexts. The fact that Go now has generics means I might actually consider it as a language, because I don't need to mess around with eg. codegen to have a maintainable base implementation.
- dilap 5y agoYeah no argument generics are very useful! But still, it's a bit of a clickbait headline -- Go isn't getting faster, it's just getting more ergonomic to write fast code. :-)
- xyzzy_plugh 5y agoMaybe I'm alone in this by, codegen is fine? After all, that's what generics is at some primitive level. The Go compiler is so bloody fast that recompiling is practically free. And it's very easy to write a code generator any number of ways.
- spoiler 5y agoBut isn't maintaining codegen more effort (and brittle) than just maintaining a generic implementation? Maye it's a matter of taste, though.
- snovv_crash 5y agoCodegen breaks debuggers.
- ogogmad 5y agokNN's and matrices? Go doesn't have operator overloading; are you sure you'd be happy using it for that?