Re:Faster Sorting with Go Generics
by nasretdinov on Saturday April 02, 2022 @04:38PM
(#30891471)
I think what people often overlook when discussing generics in Go and code performance that uses generics, is that... the most important thing here is that the code that uses generic sort implementation is: 1. much shorter and more straightforward 2. actually type safe. Even if performance of such code is the same or a bit lower, it does not matter, because the main benefit is that you finally don't have to rely on interfaces (especially an empty one in case of sort.Slice) and have fewer possibilities of runtime panics thanks to that.
[ Parent
| on HN ]
> Even if performance of such code is the same or a bit lower, it does not matter
Iām being somewhat pedantic, but that clearly depends on the application.