Closed arnorhs closed 11 years ago
there was one in the past: http://jsperf.com/sort-v8-copied/18
the idea behind is to make it generous as much as possible so u can sort anything and within any specified range
That's awesome. Do you know who the author of the algorithm is or is it just one of those general optimization techniques people try?
I've done some experiments with Introsort which is a quick sort + heap sort hybrid, but that did not have as good results.
Just wondering if the author would be offended if I plagiarized it..
if u look in source u will find the comment:
// The current implementation was derived from *BSD system qsort(): // Copyright (c) 1992, 1993 // The Regents of the University of California. All rights reserved.
Ah, thanks. Not sure how I missed that. Should have rtfm
One more thing. Did you do the port from BSD's qsort? If not, where did the JS implementation come from?
i ported it from C source code. there is no over JS versions. at least i dont know any.
Ah, I didn't know. Nice job!
The reason I'm so interested in it is that I need something similar for a project of mine.
It would be helpful if you would publish it as a stand alone module on npm. I'd be happy to do so and give you full credit and/or add you as a maintainer if that would be easier.
well u can do it yourself i guess.
Thanks. Will do.
I published the module here: https://npmjs.org/package/qsort
I tried to give credit where I could and you are listed as the author in the package.json as well.
Thanks. Definitely faster on top of being able to sort partial sets. Awesome work.
nice! thanx for the info :)
The qsort algo in jsfeat.Math looks pretty similar to an introsort, but I haven't dived into it.
I was just wondering if it actually performs better than the JS built in Array#sort() method.
Maybe I'll fork and see if I can benchmark it