Quantcast
Channel: Performance: Sorting Slice vs Sorting Type (of Slice) with Sort implementation - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by cevian for Performance: Sorting Slice vs Sorting Type (of Slice)...

adding the run output with allocations looks like the interface/struct method is better there too.❯ go versiongo version go1.17.1 darwin/amd64❯ go test -bench=. -benchmemgoos: darwingoarch: amd64pkg:...

View Article



Answer by icza for Performance: Sorting Slice vs Sorting Type (of Slice) with...

The general sort.Slice() and sort.SliceStable() functions work on any slices. You have to pass your slice value as an interface{} value, and the implementation has to use reflection (the reflect...

View Article

Performance: Sorting Slice vs Sorting Type (of Slice) with Sort implementation

I was playing with some code challenges and found that custom sort (implementation of sort interface) work much faster than just for raw structure of slices. Why is that? Does slice conversion to type...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images