zhangyunhao116 / pdqsort

Pattern-defeating quicksort in Go with generics(need Go1.18). About 2x ~ 60x faster than the built-in sort package.
MIT License
110 stars 7 forks source link

support struct sort #2

Open hawkingrei opened 2 years ago

hawkingrei commented 2 years ago

Hello, TiDB has a plan to use pdqsort to improve sort performance. but we find that Golang will support pdqsort in the Go1.19. So we decide to use this library to achieve our goals. however, we find this library only sorts this base type and we need to sort the slice of custom type. Have you a plan to improve it?

zhangyunhao116 commented 2 years ago

Happy to see TiDB plan to use the new implementation! The generic version of pdqsort is located in https://github.com/golang/exp/tree/master/slices for now, and it will be moved to the std in the future. The problem is that the APIs in the slices may be changed at any time. A possible solution is to copy the related code into the TiDB project, once the slices is merged into std, we can easily change the code. For this repo, I'm still not sure whether it needs to be maintained, since it has already been merged into the Go runtime.

hawkingrei commented 2 years ago

Thank you for your suggestion. I have started to use https://github.com/golang/exp/tree/master/slices to implement it.