4 ms·
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
by nasretdinov 5y ago
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.