News for hackers. Stuff that matters.
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.
Re:Faster Sorting with Go Generics by klysm on Saturday April 02, 2022 @04:41PM (#30891497)
> 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.

Re:Faster Sorting with Go Generics by menzoic on Saturday April 02, 2022 @05:32PM (#30891876)
You have the freedom to not use generics when the application has stricter performance requirements.