Reduce the number of valid checks for ByteBufferIndexInput#readVInt [LUCENE-10366]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
Today, we do not rewrite `#readVInt` and `#readVLong` for `ByteBufferIndexInput`. By default, the logic will call `#readByte` several times, and we need to check whether ByteBuffer is valid every time. This may not be necessary as we just need a final check.
```java
TaskQPS baseline StdDevQPS my_modified_version StdDev Pct diff p-value
BrowseDayOfYearSSDVFacets 16.74 (17.3%) 15.91 (12.3%) -5.0% ( -29% - 29%) 0.295
MedTermDayTaxoFacets 27.01 (6.9%) 26.56 (5.9%) -1.7% ( -13% - 11%) 0.402
Wildcard 111.55 (8.1%) 109.67 (7.6%) -1.7% ( -16% - 15%) 0.499
Respell 58.06 (2.6%) 57.20 (2.6%) -1.5% ( -6% - 3%) 0.074
OrHighMedDayTaxoFacets 8.91 (4.7%) 8.81 (7.2%) -1.1% ( -12% - 11%) 0.557
Fuzzy1 117.17 (3.8%) 116.14 (3.3%) -0.9% ( -7% - 6%) 0.437
Fuzzy2 103.70 (3.2%) 102.82 (4.3%) -0.9% ( -8% - 6%) 0.472
HighIntervalsOrdered 10.11 (7.9%) 10.05 (7.4%) -0.6% ( -14% - 15%) 0.797
HighTermDayOfYearSort 183.18 (8.8%) 182.92 (10.8%) -0.1% ( -18% - 21%) 0.964
AndHighHighDayTaxoFacets 11.44 (3.8%) 11.43 (3.1%) -0.1% ( -6% - 7%) 0.936
Prefix3 161.90 (13.5%) 161.80 (13.3%) -0.1% ( -23% - 30%) 0.989
HighSpanNear 11.43 (4.8%) 11.45 (4.2%) 0.1% ( -8% - 9%) 0.928
PKLookup 220.15 (3.3%) 220.69 (6.2%) 0.2% ( -8% - 10%) 0.874
MedSpanNear 92.60 (4.0%) 93.11 (3.7%) 0.5% ( -6% - 8%) 0.656
TermDTSort 143.26 (9.0%) 144.14 (10.9%) 0.6% ( -17% - 22%) 0.847
MedIntervalsOrdered 63.74 (6.6%) 64.21 (6.1%) 0.8% ( -11% - 14%) 0.707
HighTermTitleBDVSort 99.61 (9.1%) 100.49 (12.4%) 0.9% ( -18% - 24%) 0.796
LowSpanNear 126.43 (3.6%) 127.61 (3.2%) 0.9% ( -5% - 8%) 0.383
LowIntervalsOrdered 12.45 (5.4%) 12.58 (5.2%) 1.0% ( -9% - 12%) 0.535
LowTerm 1767.08 (3.7%) 1788.83 (3.1%) 1.2% ( -5% - 8%) 0.257
HighSloppyPhrase 11.45 (7.0%) 11.61 (7.1%) 1.5% ( -11% - 16%) 0.515
AndHighMedDayTaxoFacets 69.41 (3.7%) 70.46 (2.8%) 1.5% ( -4% - 8%) 0.147
BrowseRandomLabelSSDVFacets 10.85 (6.1%) 11.04 (5.1%) 1.7% ( -9% - 13%) 0.342
MedTerm 2083.04 (5.3%) 2119.48 (5.7%) 1.7% ( -8% - 13%) 0.316
LowSloppyPhrase 148.79 (3.6%) 151.76 (3.2%) 2.0% ( -4% - 9%) 0.062
HighPhrase 98.67 (3.4%) 100.80 (3.5%) 2.2% ( -4% - 9%) 0.048
OrHighNotLow 1371.31 (7.1%) 1400.91 (7.9%) 2.2% ( -12% - 18%) 0.365
BrowseMonthTaxoFacets 16.65 (11.6%) 17.03 (13.1%) 2.2% ( -20% - 30%) 0.565
OrHighNotHigh 1267.37 (6.8%) 1297.42 (8.9%) 2.4% ( -12% - 19%) 0.344
MedSloppyPhrase 39.35 (3.6%) 40.42 (4.2%) 2.7% ( -4% - 10%) 0.028
OrNotHighHigh 1190.01 (6.6%) 1224.72 (7.6%) 2.9% ( -10% - 18%) 0.194
OrHighHigh 37.72 (4.3%) 39.00 (3.4%) 3.4% ( -4% - 11%) 0.005
AndHighHigh 92.46 (4.5%) 95.76 (4.9%) 3.6% ( -5% - 13%) 0.017
OrHighNotMed 1231.31 (6.3%) 1275.65 (7.9%) 3.6% ( -9% - 18%) 0.109
OrHighMed 174.32 (3.8%) 181.43 (2.9%) 4.1% ( -2% - 11%) 0.000
AndHighLow 2761.91 (10.7%) 2885.28 (10.1%) 4.5% ( -14% - 28%) 0.175
MedPhrase 214.87 (4.9%) 224.55 (4.8%) 4.5% ( -4% - 14%) 0.003
LowPhrase 333.03 (3.8%) 348.43 (3.6%) 4.6% ( -2% - 12%) 0.000
HighTermMonthSort 159.92 (9.8%) 167.50 (14.8%) 4.7% ( -18% - 32%) 0.232
OrNotHighMed 973.50 (6.0%) 1022.10 (6.0%) 5.0% ( -6% - 18%) 0.008
BrowseRandomLabelTaxoFacets 13.14 (11.1%) 13.83 (14.0%) 5.3% ( -17% - 34%) 0.186
HighTerm 1682.54 (7.0%) 1786.66 (7.5%) 6.2% ( -7% - 22%) 0.007
AndHighMed 277.66 (3.6%) 295.75 (4.3%) 6.5% ( -1% - 14%) 0.000
BrowseDateTaxoFacets 14.81 (12.9%) 15.78 (17.1%) 6.6% ( -20% - 42%) 0.170
BrowseDayOfYearTaxoFacets 14.90 (13.1%) 15.93 (17.4%) 6.9% ( -20% - 43%) 0.158
OrNotHighLow 1255.52 (7.0%) 1344.26 (7.1%) 7.1% ( -6% - 22%) 0.002
OrHighLow 972.15 (5.3%) 1056.13 (4.8%) 8.6% ( -1% - 19%) 0.000
IntNRQ 99.91 (26.0%) 108.80 (19.2%) 8.9% ( -28% - 73%) 0.219
BrowseMonthSSDVFacets 18.62 (20.7%) 20.45 (25.0%) 9.8% ( -29% - 70%) 0.175
```
---
Migrated from [LUCENE-10366](https://issues.apache.org/jira/browse/LUCENE-10366) by Feng Guo (@gf2121), updated Jan 24 2022
Linked issues:
- #11412
- [SOLR-15943](https://issues.apache.org/jira/browse/SOLR-15943)
Pull requests: https://github.com/apache/lucene/pull/592, https://github.com/apache/lucene/pull/592
Contributor guide
Assessment
This issue has not been assessed yet.