orlp / glidesort

A Rust implementation of Glidesort, my stable adaptive quicksort/mergesort hybrid sorting algorithm.
1.57k stars 24 forks source link

Provide a way to easily reproduce benchmarks #2

Open marcospb19 opened 1 year ago

marcospb19 commented 1 year ago

Hey, glidesort is very impressive.

Could this provide an easy way to run benchmarks on our machines and see these results? (I'm willing to help if necessary).

(EDIT: by chance, I have a 4800 MHz dual-channel system available, and a 2666MHz single-channel one, I'm curious to compare bench results on both.)

LilithHafner commented 1 year ago

I'd be happy to review a PR adding glidesort to https://github.com/LilithHafner/InterLanguageSortingComparisons. I'd also consider adding it myself if there are simple instructions/examples for using this algorithm with a stable version of rust.

marcospb19 commented 1 year ago

@LilithHafner

I'd also consider adding it myself if there are simple instructions/examples for using this algorithm with a stable version of rust.

Take a look at https://docs.rs/glidesort/latest/glidesort.

There's a unstable feature flag, but it's disabled by default, so you can use it with stable Rust already.

I hope this helps.

LilithHafner commented 1 year ago

Thanks, those instructions were quite usable. I've made a PR to add glidesort to the benchmarks at InterLanguageSortingComparisons. Results indicate that glidesort underperforms rust's default sorting algorithm on that benchmark.

orlp commented 1 year ago

@marcospb19 I do plan on releasing my benchmarks in a month or two in a separate repository, to also provide open an reproducible code for my upcoming paper. However right now the code is rather... 'academic' and needs cleaning up :)

orlp commented 1 year ago

@LilithHafner As I mentioned there, you compared against [T]::sort_unstable, and on a platform where I don't claim glidesort outperforms that. It does outperform [T]::sort which is not included in your benchmark.

marcospb19 commented 1 year ago

@marcospb19 I do plan on releasing my benchmarks in a month or two in a separate repository

I'd love to see that. Why Another repository tho? I think it fits well on this crate repo.

You could add a [workspace] at the top of your Cargo.toml:

[workspace]
members = [
  ".",
  "glidesort-benchs",
]

Then you can run cargo new glidesort-benchs --bin, and it wouldn't affect the main crate.

Maybe you don't even need a workspace :thinking:, but it's a bit weird to have a project inside of another project, maybe there's some catch.

LilithHafner commented 1 year ago

The purpose of InterLanguageSortingBenchmarks is to give a rough idea of performance across languages, not within them, so the primary comparison of note there is that Julia's default sorting algorithm (which happens to be stable) is about twice as fast as glidesort in that particular benchmark on that particular system.

marcospb19 commented 1 year ago

@LilithHafner I made some comments on the PR that adds glidesort regarding how you're doing measurements, and how that probably benefits Julia's algorithm.

EDIT: I was wrong, Julia really seems to be the fastest in that benchmark.