Re: Does anyone happen to have a good pure Lua/FFI qsort for int tuples?

  • From: demetri <demetri.spanos@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 21 Jul 2015 13:44:28 -0700

Here's a (primitive) quicksort implementation I just wrote from
scratch; on my machine every run was below 30s for a 1GB array:
https://gist.github.com/Sh4rK/ebd5b7a39be70185500e


Thanks, this helped shake out some loose brain cells and I made
progress!

Using yours I was able to get performance on 1GB int arrays within
about 25% of using a C function and qsort. I then realized, after looking
at yours, that I had mistranslated the condition for reverting to an
insertion sort when working from the Apple sources, which resulted
in vastly more comparisons then needed. Now mine is within about
30% of your implementation which is plenty fast for me. I will clean
it up and post it a bit later, along with some performance comparison
scripts, in case anyone else is interested.

Thanks for your help!

Demetri

Other related posts: