lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Stuyts (JIRA)" <>
Subject [jira] Commented: (LUCENE-639) [PATCH] Slight performance improvement for readVInt() of IndexInput
Date Fri, 28 Jul 2006 09:22:15 GMT
    [ ] 
Johan Stuyts commented on LUCENE-639:

The number of times the loop is executed is indeed not known at compile time. Therefore the
loop condition is also replicated multiple times: if (b < 0).

The comment of 'readVInt()' says that between one and five bytes will be read. The unrolling
I did also reads at most five bytes. Five bytes result in 35 bits useful bits for the value,
which is more than the number of bits of the return type: int. (The comment also states that
negative numbers are not supported, reducing the number of bits of the return type to 31)

> [PATCH] Slight performance improvement for readVInt() of IndexInput
> -------------------------------------------------------------------
>                 Key: LUCENE-639
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.0.0
>            Reporter: Johan Stuyts
>            Priority: Minor
>         Attachments: Lucene2ReadVIntPerformance.patch
> By unrolling the loop in readVInt() I was able to get a slight, about 1.8 %, performance
improvement for this method. The test program invoked the method over 17 million times on
each run.
> I ran the performance tests on:
> - Windows XP Pro SP2
> - Sun JDK 1.5.0_07
> - YourKit 5.5.4
> - Lucene trunk

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


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

View raw message