Speedy Version Sorting
Last week I offered fame and fortune to anyone who could speed up our version_sorter. It’s used to sort a repo’s tags: This morning I ran the numbers and the…
Last week I offered fame and fortune to anyone who could speed up our version_sorter. It’s used to sort a repo’s tags:
This morning I ran the numbers and the winner is…
Pope!
Special thanks to @binary42, @pope, @jordi, @ahoward, @jqr, and @mikeauclair for speeding up the code.
Here are my benchmarks from fastest to slowest. I used this script with this dataset to run them.
version_sorter benchmarks sorting 1,311 tags 100 times original user system total real sort 49.840000 0.570000 50.410000 ( 60.088636) rsort 51.610000 0.610000 52.220000 ( 61.462576) ----------------------------------------------------------------- pope user system total real sort 0.650000 0.010000 0.660000 ( 0.686630) rsort 0.740000 0.010000 0.750000 ( 0.806579) ----------------------------------------------------------------- jordi user system total real sort 1.770000 0.020000 1.790000 ( 1.930918) rsort 2.240000 0.020000 2.260000 ( 2.477109) ----------------------------------------------------------------- ahoward user system total real sort 2.360000 0.020000 2.380000 ( 2.581706) rsort 2.480000 0.030000 2.510000 ( 2.796861) ----------------------------------------------------------------- binary42 user system total real sort 4.170000 0.050000 4.220000 ( 4.693593) rsort 4.470000 0.050000 4.520000 ( 5.112159) ----------------------------------------------------------------- mikeauclair user system total real sort 44.060000 0.530000 44.590000 ( 54.701128) rsort 46.280000 0.540000 46.820000 ( 54.965692) ----------------------------------------------------------------- jqr user system total real sort 48.800000 0.540000 49.340000 ( 56.063984) rsort 50.970000 0.580000 51.550000 ( 59.799366) -----------------------------------------------------------------
Pope wrote a C extension, but jordi and ahoward had impressive pure-Ruby implementations as well. Check out all the entries:
- pope/version_sorter
- jordi/version_sorter
- ahoward/version_sorter
- binary42/version_sorter
- mikeauclair/version_sorter
- jqr/version_sorter
Written by
Related posts
![](https://github.blog/wp-content/uploads/2023/09/screencapture-innovationgraph-github-2023-09-20-15_44_54-1.png?resize=400%2C212)
How researchers are using GitHub Innovation Graph data to estimate the impact of ChatGPT
An interview with economic researchers who are applying causal inference techniques to analyze the effect of generative AI tools on software development activity.
![](https://github.blog/wp-content/uploads/2024/01/Enterprise-DarkMode-1.png?resize=400%2C212)
GitHub Availability Report: June 2024
In June, we experienced two incidents that resulted in degraded performance across GitHub services.
![](https://github.blog/wp-content/uploads/2024/06/AI-DarkMode-4.png?resize=400%2C212)
Advancing responsible practices for open source AI
Outcomes from the Partnership on AI and GitHub workshop.