{"id":15733272,"url":"https://github.com/kmsquire/sortperf.jl","last_synced_at":"2025-05-06T23:15:55.160Z","repository":{"id":5952138,"uuid":"7173105","full_name":"kmsquire/SortPerf.jl","owner":"kmsquire","description":"Julia module to test the performance of sorting algorithms.","archived":false,"fork":false,"pushed_at":"2015-07-22T08:21:38.000Z","size":828,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T23:15:51.270Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kmsquire.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-14T22:43:35.000Z","updated_at":"2023-01-04T12:24:13.000Z","dependencies_parsed_at":"2022-07-28T19:29:51.501Z","dependency_job_id":null,"html_url":"https://github.com/kmsquire/SortPerf.jl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2FSortPerf.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2FSortPerf.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2FSortPerf.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kmsquire%2FSortPerf.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kmsquire","download_url":"https://codeload.github.com/kmsquire/SortPerf.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252782835,"owners_count":21803410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T00:41:34.762Z","updated_at":"2025-05-06T23:15:55.143Z","avatar_url":"https://github.com/kmsquire.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"SortPerf.jl: Module to test the performance of sorting algorithms\n--------------------------------------------------------------\n\nThe purpose of this module is to test the performance of the different sort (and related) algorithms in Julia.  See https://github.com/kmsquire/SortPerf.jl/raw/master/sortperf.pdf for an example output from Version 0.3.0-prerelease+125.\n\n\nRun with:\n\n    std_sort_tests(;sort_algs=SortPerf.sort_algs,   # [InsertionSort, HeapSort, MergeSort, \n                                                    #     QuickSort, RadixSort, TimSort]\n                    types=SortPerf.std_types,       # [Int32, Int64, Int128, Float32, Float64, String]\n                    range=6:20,                     # Array size 2^6 through 2^20, by powers of 2\n                    replicates=3,                   #\n                    lt::Function=isless,            # \\\n                    by::Function=identity,          #  | sort(...) options\n                    rev::Bool=false,                #  |\n                    order::Ordering=Forward,        # /\n                    save::Bool=false,               # create and save timing tsv and pdf plot\n                    prefix=\"sortperf\")              # prefix for saved files\n\nYou can also test individual algorithms with \n\n    sortperf(Algorithm(s), data, [size,] [replicates=xxx])\n\nSome examples:\n\n    sortperf(QuickSort, Int, 10_000)               # Test QuickSort on 10,000 random ints\n    sortperf(MergeSort, [Float32, String], 6:2:10) # Test MergeSort on 2^6, 2^8, and 2^10 float 32s and strings\n    sortperf([QuickSort, MergeSort, TimSort],      # Test QuickSort, MergeSort, and TimSort on \n             [Int, Float32, Float64, String],      # Arrays of Int, Float32, Float64, and String\n             6:20;                                 # ranging from 2^6 elements to 2^20 elements, by \n             replicates=5)                         # powers of 2, and run each test 5 times\n\nOrdering parameters accepted by sort!(...) will be passed through.\n\n\nSorting Tests\n-------------\n\nThe actual tests run include sorting arrays with the following characteristics:\n\n* random\n* sorted\n* reversed\n* sorted, but with 3 random exchanges\n* sorted, with 10 random values appended\n* 4 unique values\n* all equal\n* quicksort median killer: first half descending, second half ascending\n\nThe tests were inspired by similar tests used by sortperf in Python.  See http://svn.python.org/projects/python/trunk/Objects/listsort.txt for more details.\n\n\n\nSuggestions based on basic tests\n--------------------------------\n\nHere is a table and some notes on the Julia implementations of the\nvarious algorithms.  The table indicates the recommended sort\nalgorithm for the given size (`small \u003c ~2^12 (=8,192) items \u003c large`)\nand type (string, floating point, or integer) of data.\n\n- *Random* means that the data is permuted randomly.\n- *Structured* here means that the data contains partially sorted runs\n(such as when adding random data to an already sorted array).\n- *Few unique* indicates that the data only contains a few unique\nvalues.\n\n\n|               |(Un)stable (small)|Stable (small)|(Un)stable (large)|Stable (large)|In-place (large)|\n|---------------|:----------------:|:------------:|:----------------:|:------------:|:--------------:|\n|**Strings**    |                  |              |                  |              |                |\n|- Random       |M                 |M             |M                 |M             |Q               |\n|- Structured   |M                 |M             |T                 |T             |Q               |\n|- Few Unique   |Q                 |M             |Q                 |M             |Q               |\n|               |                  |              |                  |              |                |\n|**Float64**    |                  |              |                  |              |                |\n|- Random       |Q                 |M             |R                 |R             |Q               |\n|- Structured   |M                 |M             |T                 |T             |Q               |\n|- Few Unique   |Q                 |M             |Q                 |R             |Q               |\n|               |                  |              |                  |              |                |\n|**Int64**      |                  |              |                  |              |                |\n|- Random       |Q                 |M             |R                 |R             |Q               |\n|- Structured   |Q                 |M             |uT                |R/T           |Q               |\n|- Few Unique   |Q                 |M             |R                 |R             |Q               |\n\nKey:\n\n|Symbol|Algorithm        |\n|------|-----------------|\n|H     |`HeapSort`       |\n|I     |`InsertionSort`  |\n|M     |`MergeSort`      |\n|Q     |`QuickSort`      |\n|T     |`TimSort`        |\n|uT    |`TimSortUnstable`|\n|R     |`RadixSort`      |\n\n\nCurrent Recommendations\n-----------------------\n\n* Except for pathological cases, small arrays are sorted best with\n  `QuickSort` (unstable) or `MergeSort`` (stable)\n\n* When sorting large arrays with sections of already-sorted data, use\n  `TimSort`.  The only structured case it does not handle well is\n  reverse-sorted data with large numbers of repeat elements.  An\n  unstable version of `TimSort` (to be contributed to Julia soon) will\n  handle this case\n\n* For numerical data (Ints or Floats) without structure, `RadixSort` is\n  the best choice, except for 1) 128-bit values, or 2) 64-bit integers\n  which span the full range of values.\n\n* When memory is tight, `QuickSort` is the best in-place algorithm.  If\n  there is concern about pathological cases, use `HeapSort`.  All\n  stable algorithms use additional memory, but `TimSort` is (probably)\n  the most frugal.\n\n* **Composite types may behave differently.**  If sorting is\n  important to your application, you should test the different\n  algorithms on your own data.  This package facilitates that.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmsquire%2Fsortperf.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkmsquire%2Fsortperf.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkmsquire%2Fsortperf.jl/lists"}