Coder Social home page Coder Social logo

sorty's Introduction

sorty Go Report Card

Type-specific concurrent sorting library

sorty is an in-place QuickSort implementation (with InsertionSort as subroutine) and does not require extra memory. Call corresponding Sort*() to sort your slice in ascending order. For example:

sorty.SortS(your_string_slice, mx)

A Sort*() function should not be called by multiple goroutines at the same time. mx is the maximum number of goroutines used for sorting simultaneously.

'go test' results on various computers

All computers run 64-bit Manjaro Linux. Comparing against sort.Slice, sortutil and zermelo.

Sorting uint32 array (in seconds):

Library Acer TravelMate netbook with Intel Celeron N3160 Casper laptop with Intel Core i5-4210M Server with AMD Ryzen 5 1600
sort.Slice 144.40 68.48 67.58
sortutil 65.50 25.50 17.38
zermelo 39.40 11.35 9.51
sorty-2 26.62 15.84 15.17
sorty-3 19.27 12.99 11.33
sorty-4 15.22 11.09 9.20
sorty-5 15.16 11.15 7.89

Sorting float32 array (in seconds):

Library Acer TravelMate netbook with Intel Celeron N3160 Casper laptop with Intel Core i5-4210M Server with AMD Ryzen 5 1600
sort.Slice 147.80 69.50 71.73
sortutil 62.30 23.46 16.58
zermelo 31.20 9.26 14.55
sorty-2 32.28 19.43 23.31
sorty-3 23.36 15.59 17.69
sorty-4 20.49 13.18 14.37
sorty-5 18.59 13.35 12.45

Parameter Tuning

First, make sure everything is fine (prepend GOGC=30 to all if your ram <= 4 GiB):

go test -short -timeout 9h

You can tune Mli,Mlr for your platform/cpu with (optimization flags):

go test -timeout 99h -gcflags '-B -s' -ldflags '-s -w'

Now update Mli,Mlr in sorty.go and compare your tuned sorty with sortutil & zermelo:

go test -short -timeout 9h -gcflags '-B -s' -ldflags '-s -w'

Remember to build your sorty with the same flags you used for tuning.

sorty's People

Contributors

jfcg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.