lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Resolved: (LUCENE-1185) [PATCH] Avoid checking for TermBuffer in SegmentTermEnum#scanTo
Date Sat, 23 Feb 2008 02:37:19 GMT


Michael Busch resolved LUCENE-1185.

       Resolution: Fixed
    Fix Version/s: 2.4
    Lucene Fields: [New, Patch Available]  (was: [Patch Available, New])

Committed. Thanks Christian!

> [PATCH] Avoid checking for TermBuffer in SegmentTermEnum#scanTo
> ---------------------------------------------------------------
>                 Key: LUCENE-1185
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.3, 2.3.1, 2.4
>         Environment: any
>            Reporter: Christian Kohlschütter
>             Fix For: 2.4
>         Attachments: LUCENE-1185-SegmentTermEnum.patch
> It seems that SegmentTermEnum#scanTo is a critical method which is called very often,
especially whenever we iterate over a sequence of terms in an index.
> When that method is called, the first thing happens is that it checks whether a temporary
TermBuffer "scratch" has already been initialized.
> In fact, this is not necessary. We can simply declare and initialize the "scratch"-Buffer
at the class-level (right now, the initial value is _null_). Java's lazy-loading capabilities
allow this without adding any memory footprint for cases where we do not need that buffer.
> The attached patch takes care of this. We now save one comparison per term.
> In addition to that, the patch renames "scratch" to "scanBuffer", which aligns with the
naming of the other two buffers that are declared in the class.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

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

View raw message