lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrien Grand (JIRA)" <>
Subject [jira] [Commented] (LUCENE-7268) Remove ArrayUtil.timSort?
Date Mon, 02 May 2016 08:36:12 GMT


Adrien Grand commented on LUCENE-7268:

I did some testing and the difference seems to be due to how our impl in ArrayUtil tries to
save memory: it uses a hard-coded {{array.length/64}} as the maximum size of the temporary
Object[] that it may use for merging. If it needs less memory than that, it will use this
temporary Object[], but for larger merges it will switch to an in-place merge routine that
is much slower (the same logic that InPlaceMergeSorter uses). I get the following build times
with the patch:

|| Arrays.sort | 222ms |
|| ArrayUtil.timSort - max temp storage = array.length | 262ms |
|| ArrayUtil.timSort - max temp storage = array.length/64 (like in master) | 383ms |
|| ArrayUtil.timSort - max temp storage = 0 | 444ms |

> Remove ArrayUtil.timSort?
> -------------------------
>                 Key: LUCENE-7268
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Robert Muir
>         Attachments: LUCENE-7268_mods.patch
> Is there some workload where our timSort is better than the JDK one? Should we just remove
ours if its slower?
> Not that its a great test, but i switched Polygon2D edge sorting (just the one where
it says "sort the edges then build a balanced tree from them") from Arrays.sort to ArrayUtil.timSort
and was surprised when performance was much slower for an enormous polygon (

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message