[ 
https://issues.apache.org/jira/browse/LUCENE-6118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14250673#comment-14250673
 ] 

Ryan Ernst commented on LUCENE-6118:
------------------------------------

+1

For {{IntBag.remove()}} when the frequency reaches 0, could you find the end of 
the chain and move that back into the slot was just broken? This would then 
require moving up to only one element of the bag, instead of re-adding all 
elements after the old value in the chain. Something like:
{code}
if (newFreq == 0) {
    // move the last key in the chain back into this zeroed slot
    int slot2 = (slot + 1) & mask;
    while (freqs[slot2] != 0) {
        slot2 = (slot2 + 1) & mask;
    }
    keys[slot] = keys[slot2];
    freqs[slot] = freqs[slot2];
}
{code}

> Improve efficiency of the history structure for filter caching
> --------------------------------------------------------------
>
>                 Key: LUCENE-6118
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6118
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>         Attachments: LUCENE-6118.patch
>
>
> The filter caching uses  a ring buffer that tracks frequencies of the 
> hashcodes of the most-recently used filters. However it is based on an 
> ArrayDeque<Integer> and a HashMap<Integer> which keep on (un)wrapping ints. 
> Since the data-structure is very simple, we could try to do something 
> better...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to