Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
None
-
None
-
None
-
New
Description
When working on TimSort (LUCENE-4839), I was a little frustrated of not being able to add galloping support because it would have required to add new primitive operations in addition to compare and swap.
I started working on a prototype that uses inheritance to allow some sorting algorithms to rely on additional primitive operations. You can have a look at https://github.com/jpountz/sorts/tree/master/src/java/net/jpountz/sorts (but beware it is a prototype and still misses proper documentation and good tests).
I think it would offer several advantages:
- no more need to implement setPivot and comparePivot when using in-place merge sort or insertion sort,
- the ability to use faster stable sorting algorithms at the cost of some memory overhead (our in-place merge sort is very slow),
- the ability to implement properly algorithms that are useful on specific datasets but require different primitive operations (such as TimSort for partially-sorted data).
If you are interested in comparing these implementations with Arrays.sort, there is a Benchmark class in src/examples.
What do you think?
Attachments
Attachments
Issue Links
- relates to
-
LUCENE-5140 Slowdown of the span queries caused by LUCENE-4946
- Closed