[ANN] sorty

526 views
Skip to first unread message

Serhat Şevki Dinçer

unread,
Sep 25, 2019, 3:17:40 PM9/25/19
to golang-nuts
Hi everyone,

I've been improving type-specific concurrent sorting library sorty for a while and the results seem really competitive on different data types for such a small library (effective code is less than 200 lines). It also implements sort.Interface, though no stable sorting or worst case guarantees yet.

Let me know what you think. I am especially interested on sorting timings on non-x86 platforms.

Thanks..

Serhat Şevki Dinçer

unread,
Jan 3, 2020, 4:11:08 AM1/3/20
to golang-nuts
Hi,

sorty v0.4.0 is released with:

// Sort3 concurrently sorts underlying collection of length n via
// lesswap() which must be equivalent to:
//  if less(i, k) {
//      if r != s {
//          swap(r, s)
//      }
//      return true
//  }
//  return false
func Sort3(n int, lesswap func(i, k, r, s int) bool)

This function based method is faster than sorty.Collection2, which in turn is faster than sort.Interface (just as a way to access generic collections).

Let me know what you think, cheers..

Serhat Şevki Dinçer

unread,
May 9, 2020, 6:53:40 AM5/9/20
to golang-nuts
Hello,

sorty v1.0 was released with:

- Concurrent dual partitioning (for initial long ranges)
- Median-of-5 / 9 pivotting with scheduling
- Sub-range assistive pivotting
- Simplified api (no interfaces)
- Other small improvements

Let me know what you think,
Cheers..

jfcg...@gmail.com

unread,
Oct 4, 2021, 5:52:04 PM10/4/21
to golang-nuts
Hi all,

I've released sorty v1.2. Now it natively sorts [][]byte, []float32, []float64, []int, []int32, []int64, []uintptr, []string, []uint, []uint32, []uint64.
Also it natively sorts []string and [][]T (for any type T) by length.

Cheers..

jfcg...@gmail.com

unread,
Oct 24, 2021, 7:23:48 PM10/24/21
to golang-nuts
Hi,

sorty v2.0 has been released with greatly simplified API. It is now possible to sort same underlying native slices (like []int, []MyInt or IntSlice) without a cast.

Best..

jfcg...@gmail.com

unread,
Feb 10, 2023, 10:36:22 PM2/10/23
to golang-nuts
Hi,

sorty v2.1.0 has been released. The changes are:
  • Use any instead of interface{}. This pushes go version in go.mod to 1.18.
  • Add matrix strategy and workflow dependencies to github workflows. They now run on ubuntu/windows/macos with go 1.19/1.20 and GOAMD64=v2.
  • Similarly add matrix strategy to github workflows of sorty's dependencies jfcg/sixb and jfcg/rng.
  • Add a parameter tuning workflow that runs on dev branch.
  • Major rewrite of tests with random inputs generated with jfcg/rng and running automatically for 1..min(4,NumCPU) cores.
  • Add NaNoption for treatment of NaNs in SortSlice().
  • Major rewrite of insertion sort, pivotting & partitioning parts. Specifically swapping condition switched from a<pivot<b to (a≤pivot<b or a<pivotb) in SortSlice() and SortLen().
  • Various other cleanups and minor improvements.
Cheers..
Reply all
Reply to author
Forward
0 new messages