Skip to content

Conversation

@sts10
Copy link
Owner

@sts10 sts10 commented Feb 8, 2023

Uses glidesort v0.1.2 for sorting words alphabetically. Though I'm not sure this will make an appreciable performance difference until we're sorting millions of elements?

@sts10
Copy link
Owner Author

sts10 commented Feb 9, 2023

As an informal benchmark, I ran Tidy with no options on the 4 EFF fandom word lists, to combine (and sort) these four lists into one. I used hyperfine, with settings: 15 warm-ups runs, 50 runs.

Without glidesort:

  Time (mean ± σ):     129.8 ms ±  10.2 ms    [User: 104.3 ms, System: 25.2 ms]
  Range (min … max):   116.9 ms … 158.0 ms    50 runs

With glidesort:

  Time (mean ± σ):     122.3 ms ±   4.7 ms    [User: 98.8 ms, System: 23.3 ms]
  Range (min … max):   115.2 ms … 133.4 ms    50 runs

So it's a little quicker!

But then, as a second benchmark, I ran Tidy on a randomly shuffled 40,000-word list; my idea being in this benchmark, Tidy wouldn't be de-duplicating words, just purely sorting them into alphabetical order.

Without glidesort:

  Time (mean ± σ):     304.1 ms ±  21.6 ms    [User: 263.4 ms, System: 40.2 ms]
  Range (min … max):   279.4 ms … 393.1 ms    150 runs

With glidesort:

  Time (mean ± σ):     326.4 ms ±  16.3 ms    [User: 285.0 ms, System: 40.7 ms]
  Range (min … max):   300.0 ms … 396.0 ms    150 runs

Which is interesting (and a little surprising/frustrating)!

I also ran a third benchmark, giving each version a 40k word list with one single word out of alphabetical order. Without glidesort was about 6 ms quicker.

Not sure whether to merge this at this time...

@sts10
Copy link
Owner Author

sts10 commented Feb 9, 2023

I've now created a separate Rust project to more thoroughly benchmark sort_by/sort_unstable_by/glidesort::sort_by options: https://github.com/sts10/sort_bench

In those tests, on my machine, glidesort beats the other two options by a bit.

@sts10
Copy link
Owner Author

sts10 commented Nov 22, 2023

Closing this for now.

@sts10 sts10 closed this Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants