lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrien Grand (JIRA)" <>
Subject [jira] [Commented] (LUCENE-2357) Reduce transient RAM usage while merging by using packed ints array for docID re-mapping
Date Fri, 01 Jun 2012 16:04:23 GMT


Adrien Grand commented on LUCENE-2357:

Hi Otis,

Before this change, each doc map used ~ {{maxDoc * 32}} bits while they now use ~ {{maxDoc
* lg(min(numDocs, numDeletedDocs))}} (where lg is the ceil of log in base 2) bits. So even
in the worst case (numDocs = numDeleted = maxDoc / 2), the improvement is {{((31 - lg(maxDoc))/32}}.
On a segment with maxDoc=10000000, this is a 22% improvement. But the improvement is much
better when the number of deleted documents is close to 0 or to maxDoc. For example, if your
segment has maxDoc=10000000 and numDeletedDocs=100000, the improvement ({{32 - lg(min(numDocs,
numDeletedDocs))/32}}) is close to 50%. If numDeletedDocs=100, the improvement is close to
> Reduce transient RAM usage while merging by using packed ints array for docID re-mapping
> ----------------------------------------------------------------------------------------
>                 Key: LUCENE-2357
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: core/index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 4.0
>         Attachments: LUCENE-2357.patch, LUCENE-2357.patch, LUCENE-2357.patch, LUCENE-2357.patch,
> We allocate this int[] to remap docIDs due to compaction of deleted ones.
> This uses alot of RAM for large segment merges, and can fail to allocate due to fragmentation
on 32 bit JREs.
> Now that we have packed ints, a simple fix would be to use a packed int array... and
maybe instead of storing abs docID in the mapping, we could store the number of del docs seen
so far (so the remap would do a lookup then a subtract).  This may add some CPU cost to merging
but should bring down transient RAM usage quite a bit.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


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

View raw message