Skip to content

Simple64 - #16245

Open
vsop-479 wants to merge 52 commits into
apache:mainfrom
vsop-479:simple64
Open

Simple64#16245
vsop-479 wants to merge 52 commits into
apache:mainfrom
vsop-479:simple64

Conversation

@vsop-479

@vsop-479 vsop-479 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Description

Simple64: pack multiple small non-negative integers into a single long.

This change try to implement Simple64 to bulk encode/decode small ints, and use it to write terms' suffixLengths or somewhere else.

@vsop-479
vsop-479 marked this pull request as draft June 11, 2026 09:37
@vsop-479 vsop-479 added the skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check. label Jun 12, 2026
@vsop-479

Copy link
Copy Markdown
Contributor Author

This change has passed the core tests. And I measured its performance:

When suffix lengths are small (1~8), each value fits in a single VInt byte, making VInt extremely fast due to near-perfect branch prediction. Simple64 is slower in this case (~1.6x disadvantage).

When suffix lengths are larger (1~200), some values spill into two VInt bytes, causing branch mispredictions. Simple64 pulls ahead here (~1.3x advantage) since it uses pure bitwise operations with no branching.

For typical BlockTree suffix lengths (1~15), values stay within the single-byte VInt range, so VInt is likely faster in practice. Simple64's main benefit in this scenario is compression ratio rather than decode speed — it uses roughly half the bytes of VInt for small integers.

@vsop-479

Copy link
Copy Markdown
Contributor Author

suffix length: 1 ~ 8 integers

Benchmark                         (blockSize)  (maxSuffix)   Mode  Cnt   Score   Error   Units
Simple64Benchmark.decodeSimple64           40            8  thrpt    5  50.400 ± 0.892  ops/us
Simple64Benchmark.decodeVInt               40            8  thrpt    5  76.696 ± 0.453  ops/us

Simple64Benchmark.encodeSimple64           40            8  thrpt    5  17.514 ± 0.395  ops/us
Simple64Benchmark.encodeVInt               40            8  thrpt    5  88.496 ± 3.522  ops/us

suffix length: 1 ~ 200 integers

Benchmark                         (blockSize)  (maxSuffix)   Mode  Cnt   Score   Error   Units
Simple64Benchmark.decodeSimple64           40          200  thrpt    5  37.229 ± 0.455  ops/us
Simple64Benchmark.decodeVInt               40          200  thrpt    5  27.770 ± 0.228  ops/us

Simple64Benchmark.encodeSimple64           40          200  thrpt    5   7.014 ± 0.245  ops/us
Simple64Benchmark.encodeVInt               40          200  thrpt    5  26.317 ± 2.062  ops/us

@vsop-479
vsop-479 marked this pull request as ready for review June 16, 2026 08:18
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Jul 1, 2026
@vsop-479

vsop-479 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

After unrolling, Simple64 decode beats VInt across SMALL_1_8, MID_1_64, and LARGE_1_200, with the gap much larger on LARGE_1_200 (~ +47%) than on SMALL_1_8/MID_1_64 (~ +1-8%):

Benchmark                         (blockSize)  (distribution)   Mode  Cnt   Score   Error   Units
Simple64Benchmark.decodeSimple64           40       SMALL_1_8  thrpt    5  31.479 ± 0.289  ops/us
Simple64Benchmark.decodeSimple64           40        MID_1_64  thrpt    5  29.405 ± 0.197  ops/us
Simple64Benchmark.decodeSimple64           40     LARGE_1_200  thrpt    5  29.014 ± 0.209  ops/us
Simple64Benchmark.decodeSimple64           40           MIXED  thrpt    5  28.845 ± 0.100  ops/us
Simple64Benchmark.decodeVInt               40       SMALL_1_8  thrpt    5  29.156 ± 0.434  ops/us
Simple64Benchmark.decodeVInt               40        MID_1_64  thrpt    5  29.210 ± 0.205  ops/us
Simple64Benchmark.decodeVInt               40     LARGE_1_200  thrpt    5  19.704 ± 0.170  ops/us
Simple64Benchmark.decodeVInt               40           MIXED  thrpt    5  29.209 ± 0.200  ops/us
Simple64Benchmark.encodeSimple64           40       SMALL_1_8  thrpt    5  13.937 ± 0.200  ops/us
Simple64Benchmark.encodeSimple64           40        MID_1_64  thrpt    5   4.809 ± 0.022  ops/us
Simple64Benchmark.encodeSimple64           40     LARGE_1_200  thrpt    5   3.832 ± 0.047  ops/us
Simple64Benchmark.encodeSimple64           40           MIXED  thrpt    5   4.995 ± 0.035  ops/us
Simple64Benchmark.encodeVInt               40       SMALL_1_8  thrpt    5  67.789 ± 0.568  ops/us
Simple64Benchmark.encodeVInt               40        MID_1_64  thrpt    5  67.903 ± 0.231  ops/us
Simple64Benchmark.encodeVInt               40     LARGE_1_200  thrpt    5  14.346 ± 0.091  ops/us
Simple64Benchmark.encodeVInt               40           MIXED  thrpt    5  68.144 ± 0.749  ops/us

@vsop-479

vsop-479 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@mikemccand Please take a look when you get a chance -- there are TODOs mentioning simple64 in Lucene103BlockTreeTermsWriter.
Also, simple64 performs significantly faster than VInt in the LARGE_1_200 scenario, so it might be worth considering using it in other place as well.

@vsop-479

vsop-479 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mikemccand for the detailed review and all the suggestions. I pushed updates addressing the comments.

I'm worried about the added GC (allocating lots of small things, briefly). They are short lived so maybe it's all in the noise. Have you run luceneutil benchy to check?

Yes, this change does add allocations for simple64 decoding (but it no longer uses suffixLengthBytes or suffixLengthsReader).
I will run luceneutil.

Was there no existing reasonably-licensed open source Simple64 impl already?

I looked around but did not find a mature, reasonably licensed Simple64 implementation.

@vsop-479

Copy link
Copy Markdown
Contributor Author

@mikemccand I ran luceneutil on wikimediumall. The results are mixed: some tasks improved, some tasks regressed.

Note: the two indexes did not end up with the same segmentlayout. The baseline has 23 segments(Reader has 15 slices, from 23 segments), while the candidate has 15 segments(Reader has 11 slices, from 15 segments).

search perf

                TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
             LowIntervalsOrdered      370.76      (7.8%)      226.93      (2.8%)  -38.8% ( -45% -  -30%) 0.000
                      TermDTSort      283.03      (8.7%)      212.50      (2.8%)  -24.9% ( -33% -  -14%) 0.000
             MedIntervalsOrdered       84.69      (9.1%)       65.34      (5.7%)  -22.8% ( -34% -   -8%) 0.000
                        BM25MSM2       32.55      (6.0%)       25.90      (4.8%)  -20.4% ( -29% -  -10%) 0.000
            HighIntervalsOrdered       46.12      (6.8%)       36.94      (5.9%)  -19.9% ( -30% -   -7%) 0.000
                 LowSloppyPhrase       37.97      (5.2%)       30.43      (4.5%)  -19.9% ( -28% -  -10%) 0.000
                     LowSpanNear      341.24      (7.7%)      275.33      (6.4%)  -19.3% ( -31% -   -5%) 0.000
           HighTermDayOfYearSort      263.26      (8.3%)      212.94      (4.6%)  -19.1% ( -29% -   -6%) 0.000
            HighTermTitleBDVSort       37.46      (4.2%)       30.65      (7.1%)  -18.2% ( -28% -   -7%) 0.000
                          IntNRQ      136.34      (7.6%)      112.03      (6.2%)  -17.8% ( -29% -   -4%) 0.000
                       MedPhrase      326.85      (6.8%)      277.01      (8.4%)  -15.2% ( -28% -    0%) 0.000
                   OrHighNotHigh      877.90     (10.9%)      760.14     (14.3%)  -13.4% ( -34% -   13%) 0.001
                     MedSpanNear      161.20      (6.4%)      139.76      (6.6%)  -13.3% ( -24% -    0%) 0.000
                 MedSloppyPhrase      114.43      (6.4%)       99.46      (7.4%)  -13.1% ( -25% -    0%) 0.000
                    HighSpanNear       23.63      (3.7%)       20.57      (4.1%)  -12.9% ( -20% -   -5%) 0.000
                      AndHighMed      503.88     (13.7%)      444.40      (8.5%)  -11.8% ( -29% -   12%) 0.001
                       OrHighMed      669.35     (10.6%)      592.70      (6.4%)  -11.5% ( -25% -    6%) 0.000
                      OrHighHigh      271.73     (13.1%)      240.62     (11.3%)  -11.4% ( -31% -   14%) 0.004
        AndHighHighDayTaxoFacets        8.85      (4.9%)        7.90      (3.8%)  -10.8% ( -18% -   -2%) 0.000
                     AndHighHigh      226.98     (11.7%)      206.78     (10.9%)   -8.9% ( -28% -   15%) 0.015
                         Prefix3     1199.87     (10.0%)     1106.83     (11.0%)   -7.8% ( -26% -   14%) 0.023
         AndHighMedDayTaxoFacets      186.03      (4.7%)      172.02      (6.7%)   -7.5% ( -18% -    3%) 0.000
          OrHighMedDayTaxoFacets       14.97      (4.1%)       14.11      (4.1%)   -5.8% ( -13% -    2%) 0.000
                      HighPhrase       78.30      (5.7%)       74.79      (6.4%)   -4.5% ( -15% -    8%) 0.023
                HighSloppyPhrase       16.26      (4.3%)       15.69      (2.9%)   -3.5% ( -10% -    3%) 0.003
                    OrHighNotLow     1640.86      (9.2%)     1585.33      (6.4%)   -3.4% ( -17% -   13%) 0.188
            MedTermDayTaxoFacets       48.91      (4.6%)       47.46      (4.0%)   -3.0% ( -11% -    5%) 0.035
                    OrHighNotMed      831.80     (14.9%)      808.40      (8.9%)   -2.8% ( -23% -   24%) 0.479
     BrowseRandomLabelSSDVFacets        5.79      (8.9%)        5.65     (11.3%)   -2.4% ( -20% -   19%) 0.461
       BrowseDayOfYearSSDVFacets        7.21     (11.1%)        7.05     (12.7%)   -2.2% ( -23% -   24%) 0.570
               HighTermTitleSort      130.27      (9.6%)      127.68      (6.6%)   -2.0% ( -16% -   15%) 0.455
                    OrNotHighLow     1669.61      (8.4%)     1638.80     (11.2%)   -1.8% ( -19% -   19%) 0.565
                       LowPhrase      581.10      (8.7%)      577.82     (10.9%)   -0.6% ( -18% -   20%) 0.860
                       OrHighLow     1452.82      (8.1%)     1461.18      (9.0%)    0.6% ( -15% -   19%) 0.836
                          IntSet      892.43     (16.9%)      903.18     (13.4%)    1.2% ( -24% -   37%) 0.808
           BrowseMonthSSDVFacets        7.35     (15.3%)        7.53     (23.1%)    2.5% ( -31% -   48%) 0.698
            BrowseDateSSDVFacets        1.34     (10.6%)        1.39     (11.3%)    4.1% ( -16% -   29%) 0.252
                      AndHighLow     1576.04     (12.0%)     1643.83     (14.1%)    4.3% ( -19% -   34%) 0.312
                          Fuzzy1      127.34      (4.5%)      135.47      (4.7%)    6.4% (  -2% -   16%) 0.000
                         MedTerm     1431.35     (10.7%)     1523.34     (11.3%)    6.4% ( -14% -   31%) 0.072
                  AndMissingHigh     4663.20     (12.2%)     5044.04     (12.3%)    8.2% ( -14% -   37%) 0.040
                           range     4585.52     (10.5%)     4986.56     (12.1%)    8.7% ( -12% -   34%) 0.017
                        HighTerm     1075.60     (11.3%)     1182.52     (13.6%)    9.9% ( -13% -   39%) 0.014
                    OrNotHighMed      568.44     (10.1%)      635.47     (20.7%)   11.8% ( -17% -   47%) 0.025
                        PKLookup      417.41      (3.4%)      470.58      (5.0%)   12.7% (   4% -   21%) 0.000
                       ConstMSM2     1673.63     (13.9%)     1907.07     (10.3%)   13.9% (  -9% -   44%) 0.000
                        Wildcard       20.58      (3.3%)       23.75      (5.3%)   15.4% (   6% -   24%) 0.000
                         LowTerm     1875.89     (20.2%)     2208.92     (18.8%)   17.8% ( -17% -   71%) 0.005
                          Fuzzy2       92.75      (3.4%)      109.89      (5.3%)   18.5% (   9% -   28%) 0.000
               HighTermMonthSort     1684.36      (9.1%)     1997.24     (10.8%)   18.6% (  -1% -   42%) 0.000
                         Respell       93.80      (3.0%)      112.09      (4.1%)   19.5% (  12% -   27%) 0.000
                   OrNotHighHigh      402.08      (7.4%)      548.50     (11.9%)   36.4% (  15% -   60%) 0.000
            BrowseDateTaxoFacets        5.32     (14.1%)        7.96     (42.0%)   49.6% (  -5% -  122%) 0.000
       BrowseDayOfYearTaxoFacets        5.36     (13.8%)        8.04     (43.7%)   50.0% (  -6% -  124%) 0.000
     BrowseRandomLabelTaxoFacets        4.30      (9.3%)        7.23     (80.6%)   68.4% ( -19% -  174%) 0.000
           BrowseMonthTaxoFacets        5.13      (7.1%)       11.33     (77.9%)  120.7% (  33% -  221%) 0.000

search gc stats

Metric Baseline Candidate Difference
Elapsed time 17,632 ms 15,212 ms -2,420 ms
JIT compilation time 11,893 ms 11,784 ms -109 ms
Young GC time 15 ms 12 ms -3 ms
Young GC collections 10 8 -2
Old GC time 21 ms 20 ms -1 ms
Old GC collections 1 1 0
Total GC time 36 ms 32 ms -4 ms
Total GC share of elapsed time 0.20% 0.21% +0.01 pp
Average CPU load 582.25 / 1200 605.78 / 1200 +23.53

Indexing stats

Metric Baseline Candidate Difference
Total docs 33,332,620 33,332,620 0
Indexing done time 7,520,478 ms 3,851,732 ms -3,668,746 ms
Wait for merges time 708 ms 694 ms -14 ms
Commit time 81 ms 17 ms -64 ms
Finished time 7,521,314 ms 3,852,491 ms -3,668,823 ms
Final segment count 23 15 -8
Plain text indexing throughput 14.06 GB/hour 27.46 GB/hour +95.2%

Note: the final segment layout differs between the two runs, so the indexing throughput comparison may include merge/segment-layout effects in addition to the codec change.

tim store

Metric Baseline Candidate Difference
.tim files 23 15 -8
du -sh 1.3G 1.1G ~-0.2G

@vsop-479

Copy link
Copy Markdown
Contributor Author

So this means we pre-decode all term suffix lengths for the terms in the block, up front? Vs before when we would incrementally .readVInt() on iterating each term in the block?

We could later decode one long only when we need to scan its corresponding suffixLengths.

This has already been implemented.

I will try to implement decoding a single int from one long, instead of decoding all ints from that long.
I should probably also first try to make the segment counts more consistent between baseline and candidate.

@mikemccand

Copy link
Copy Markdown
Member

Note: the two indexes did not end up with the same segmentlayout. The baseline has 23 segments(Reader has 15 slices, from 23 segments), while the candidate has 15 segments(Reader has 11 slices, from 15 segments).

Maybe rerun with single segment (force merge to 1)? At least then the results are comparable to one another, though less realistic for near-real-time cases.

@mikemccand

Copy link
Copy Markdown
Member

Thanks @vsop-479 I'll try to have another look hopefully next few days.

@vsop-479

vsop-479 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Maybe rerun with single segment (force merge to 1)? At least then the results are comparable to one another, though less realistic for near-real-time cases.

+1, I think the difference in segments counts comes from the fact that we create baseline index with useCMS=True and mergePolicy="TieredMergePolicy" in example.py, but create candidate_index without these args which will use LogDocMergePolicy, Use ConcurrentMergeScheduler: false defaultly.

I will add the same args to candidate_index to check.

@vsop-479

Copy link
Copy Markdown
Contributor Author

Maybe rerun with single segment (force merge to 1)? At least then the results are comparable to one another, though less realistic for near-real-time cases.

I will add the same args to candidate_index to check.

After setting useCMS=True and mergePolicy="TieredMergePolicy" in example.py, the segment counts for baseline and candidate are the same(both 23). And the performance make more sense:

search perf

                TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                         Respell       72.88      (3.9%)       66.79      (4.0%)   -8.4% ( -15% -    0%) 0.000
                          Fuzzy2      106.10      (3.7%)       98.78      (5.8%)   -6.9% ( -15% -    2%) 0.000
                   OrHighNotHigh      767.39      (9.0%)      718.70      (7.5%)   -6.3% ( -20% -   11%) 0.018
                  AndMissingHigh     4754.32      (9.6%)     4517.80      (9.1%)   -5.0% ( -21% -   15%) 0.101
                          Fuzzy1       90.47      (4.9%)       86.13      (5.8%)   -4.8% ( -14% -    6%) 0.006
                          IntSet     1000.09     (11.8%)      957.58     (15.3%)   -4.3% ( -28% -   25%) 0.338
               HighTermTitleSort       86.95     (10.0%)       83.95      (8.7%)   -3.4% ( -20% -   16%) 0.256
     BrowseRandomLabelSSDVFacets        5.93     (12.2%)        5.74     (10.5%)   -3.2% ( -23% -   22%) 0.384
                      AndHighMed      777.15     (11.1%)      754.51     (10.7%)   -2.9% ( -22% -   21%) 0.409
                         Prefix3     1119.08     (18.0%)     1087.80     (14.8%)   -2.8% ( -30% -   36%) 0.601
           HighTermDayOfYearSort      291.52     (10.5%)      283.73      (9.2%)   -2.7% ( -20% -   19%) 0.404
                     MedSpanNear      158.72      (7.3%)      155.11      (6.9%)   -2.3% ( -15% -   12%) 0.325
                    OrNotHighLow     1841.30     (10.2%)     1800.26     (11.1%)   -2.2% ( -21% -   21%) 0.519
                      OrHighHigh      298.07     (13.1%)      291.47     (12.8%)   -2.2% ( -24% -   27%) 0.598
                 MedSloppyPhrase      197.58      (8.2%)      193.49      (8.4%)   -2.1% ( -17% -   15%) 0.441
                      TermDTSort      277.63      (6.3%)      272.34      (6.0%)   -1.9% ( -13% -   11%) 0.338
                   OrNotHighHigh      287.85      (5.9%)      282.48      (7.7%)   -1.9% ( -14% -   12%) 0.403
                        BM25MSM2       33.42      (5.8%)       32.81      (7.1%)   -1.8% ( -13% -   11%) 0.386
                         MedTerm     1343.32     (17.0%)     1319.14     (15.9%)   -1.8% ( -29% -   37%) 0.736
            BrowseDateSSDVFacets        1.28      (8.3%)        1.26      (8.1%)   -1.8% ( -16% -   15%) 0.509
                      AndHighLow     1981.80     (10.2%)     1951.18      (9.6%)   -1.5% ( -19% -   20%) 0.631
                    HighSpanNear       17.67      (6.0%)       17.41      (7.4%)   -1.5% ( -14% -   12%) 0.500
         AndHighMedDayTaxoFacets      249.07      (5.0%)      245.53      (6.7%)   -1.4% ( -12% -   10%) 0.461
                       OrHighMed      705.24      (9.7%)      697.01     (10.1%)   -1.2% ( -19% -   20%) 0.717
                     AndHighHigh      323.59     (11.9%)      319.94     (11.8%)   -1.1% ( -22% -   25%) 0.769
                         LowTerm     2075.56     (19.8%)     2053.99     (17.8%)   -1.0% ( -32% -   45%) 0.865
                       OrHighLow     1268.68     (10.3%)     1256.38     (10.3%)   -1.0% ( -19% -   21%) 0.772
                       ConstMSM2     1922.70     (13.1%)     1906.82     (12.2%)   -0.8% ( -23% -   28%) 0.841
       BrowseDayOfYearSSDVFacets        7.08     (11.0%)        7.02     (11.2%)   -0.8% ( -20% -   23%) 0.821
             LowIntervalsOrdered       56.54      (9.6%)       56.08      (8.6%)   -0.8% ( -17% -   19%) 0.783
                          IntNRQ      161.59      (6.0%)      160.46      (8.8%)   -0.7% ( -14% -   15%) 0.775
                    OrNotHighMed      575.21      (8.3%)      571.27      (9.3%)   -0.7% ( -16% -   18%) 0.811
                HighSloppyPhrase      102.71      (9.8%)      102.01      (8.7%)   -0.7% ( -17% -   19%) 0.821
                 LowSloppyPhrase      322.15      (6.7%)      320.17      (5.2%)   -0.6% ( -11% -   12%) 0.752
                       LowPhrase       74.96      (5.3%)       74.58      (5.0%)   -0.5% ( -10% -   10%) 0.765
                        Wildcard       83.22      (5.0%)       82.80      (3.7%)   -0.5% (  -8% -    8%) 0.726
               HighTermMonthSort     1756.28      (7.4%)     1747.85      (9.2%)   -0.5% ( -15% -   17%) 0.859
                    OrHighNotLow     1053.05     (13.8%)     1049.42     (13.9%)   -0.3% ( -24% -   31%) 0.939
        AndHighHighDayTaxoFacets       23.02      (3.6%)       22.94      (4.4%)   -0.3% (  -8% -    7%) 0.798
          OrHighMedDayTaxoFacets        7.44      (3.2%)        7.42      (2.7%)   -0.3% (  -5% -    5%) 0.759
                     LowSpanNear      145.76      (5.8%)      145.43      (5.9%)   -0.2% ( -11% -   12%) 0.905
            HighIntervalsOrdered       36.61      (8.2%)       36.61     (10.5%)   -0.0% ( -17% -   20%) 0.998
            MedTermDayTaxoFacets       53.66      (4.8%)       53.73      (3.6%)    0.1% (  -7% -    8%) 0.918
                       MedPhrase      318.83      (6.0%)      319.29      (4.9%)    0.1% ( -10% -   11%) 0.934
            HighTermTitleBDVSort       48.66      (5.2%)       48.78      (5.7%)    0.3% ( -10% -   11%) 0.885
                      HighPhrase      111.59      (6.3%)      112.07      (8.5%)    0.4% ( -13% -   16%) 0.861
                           range     8167.95     (15.7%)     8205.54     (11.2%)    0.5% ( -22% -   32%) 0.917
     BrowseRandomLabelTaxoFacets        4.08     (20.4%)        4.12     (16.7%)    0.9% ( -30% -   47%) 0.878
                        PKLookup      419.03      (3.7%)      423.69      (3.6%)    1.1% (  -5% -    8%) 0.350
                    OrHighNotMed      668.67      (9.7%)      679.16     (10.3%)    1.6% ( -16% -   23%) 0.630
             MedIntervalsOrdered       95.92      (4.2%)       98.20      (4.0%)    2.4% (  -5% -   10%) 0.071
           BrowseMonthTaxoFacets        4.99      (9.9%)        5.16      (6.2%)    3.3% ( -11% -   21%) 0.216
                        HighTerm      653.40     (14.7%)      680.15     (11.4%)    4.1% ( -19% -   35%) 0.338
            BrowseDateTaxoFacets        4.88     (21.9%)        5.09     (20.8%)    4.3% ( -31% -   60%) 0.539
       BrowseDayOfYearTaxoFacets        4.92     (22.1%)        5.14     (20.2%)    4.5% ( -30% -   60%) 0.515
           BrowseMonthSSDVFacets        7.16     (15.4%)        7.49     (19.1%)    4.5% ( -25% -   46%) 0.422

search gc stats

Metric Baseline Candidate Difference
Elapsed time 16,220 ms 17,044 ms +824 ms
JIT compilation time 14,115 ms 14,529 ms +414 ms
Young GC time 13 ms 15 ms +2 ms
Young GC collections 9 9 0
Old GC time 20 ms 21 ms +1 ms
Old GC collections 1 1 0
Total GC time 33 ms 36 ms +3 ms
Total GC share of elapsed time 0.20% 0.21% +0.01 pp
Average CPU load 637.97 / 1200 635.35 / 1200 -2.62

Indexing stats

Metric Baseline Candidate Difference
Total docs 33,332,620 33,332,620 0
Indexing done time 5,260,656 ms 3,362,047 ms -1,898,609 ms
Wait for merges time 832 ms 750 ms -82 ms
Commit time 25 ms 23 ms -2 ms
Finished time 5,261,551 ms 3,362,859 ms -1,898,692 ms
Final segment count 23 23 0
Index size as committed 19,486,398,890 bytes 19,461,826,218 bytes -24,572,672 bytes
Plain text indexing throughput 20.10 GB/hour 31.46 GB/hour +56.5%

tim store

Metric Baseline Candidate Difference
.tim files 23 23 0
.tim disk usage 1.3G 1.2G -0.1G

@vsop-479

Copy link
Copy Markdown
Contributor Author

I will try to implement decoding a single int from one long, instead of decoding all ints from that long.

I implemented decoding a single int from one long, to instead of decoding all ints from that long.

When decoding a single int, Simple64 may not have an advantage over VInt for values below 128 (1-byte). Simple64 is more likely to help when the value is above 127 (multi-byte).

@vsop-479

Copy link
Copy Markdown
Contributor Author

Performance fo decoding a single int

TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                         Respell       45.15      (3.1%)       40.68      (3.0%)   -9.9% ( -15% -   -3%) 0.000
                         LowTerm     2340.61     (19.2%)     2189.26     (21.4%)   -6.5% ( -39% -   42%) 0.315
                          Fuzzy1      104.99      (5.2%)       98.70      (4.8%)   -6.0% ( -15% -    4%) 0.000
                        Wildcard       85.30      (4.1%)       80.23      (3.7%)   -5.9% ( -13% -    1%) 0.000
                       ConstMSM2     1774.59     (20.4%)     1685.16     (13.6%)   -5.0% ( -32% -   36%) 0.358
                           range     8393.62     (14.4%)     7971.99     (12.7%)   -5.0% ( -28% -   25%) 0.243
                          Fuzzy2      101.52      (5.7%)       96.66      (5.0%)   -4.8% ( -14% -    6%) 0.005
       BrowseDayOfYearTaxoFacets        5.44     (15.2%)        5.20     (10.8%)   -4.4% ( -26% -   25%) 0.287
                      OrHighHigh      296.12     (11.8%)      283.41     (10.3%)   -4.3% ( -23% -   20%) 0.220
            BrowseDateTaxoFacets        5.40     (15.2%)        5.17     (11.7%)   -4.2% ( -27% -   26%) 0.326
                     AndHighHigh      184.09     (14.5%)      176.86     (12.9%)   -3.9% ( -27% -   27%) 0.366
     BrowseRandomLabelTaxoFacets        4.40     (15.2%)        4.25     (11.3%)   -3.5% ( -26% -   27%) 0.408
                         MedTerm     1299.74     (14.9%)     1257.19     (15.7%)   -3.3% ( -29% -   32%) 0.499
                        HighTerm     1044.58     (14.9%)     1012.16     (15.4%)   -3.1% ( -29% -   31%) 0.517
           BrowseMonthTaxoFacets        5.18      (8.2%)        5.02      (6.6%)   -3.0% ( -16% -   12%) 0.194
                      AndHighMed      373.87     (13.2%)      362.57     (12.1%)   -3.0% ( -24% -   25%) 0.449
                    OrNotHighLow     1604.26     (12.4%)     1558.24     (12.6%)   -2.9% ( -24% -   25%) 0.468
                    OrNotHighMed      571.91     (12.7%)      556.11     (11.6%)   -2.8% ( -24% -   24%) 0.473
                       OrHighMed      741.26     (13.2%)      722.03     (12.8%)   -2.6% ( -25% -   26%) 0.527
                   OrHighNotHigh      546.01      (9.7%)      532.77     (10.4%)   -2.4% ( -20% -   19%) 0.447
                       OrHighLow     1539.49     (11.7%)     1502.41     (12.2%)   -2.4% ( -23% -   24%) 0.523
                      AndHighLow     1687.99     (10.2%)     1650.10     (10.1%)   -2.2% ( -20% -   20%) 0.485
                    OrHighNotMed      562.55      (8.5%)      550.17     (10.4%)   -2.2% ( -19% -   18%) 0.463
          OrHighMedDayTaxoFacets       15.58      (3.7%)       15.27      (4.4%)   -2.0% (  -9% -    6%) 0.113
                  AndMissingHigh     4634.11     (13.4%)     4541.62     (13.7%)   -2.0% ( -25% -   28%) 0.641
               HighTermMonthSort     1718.57      (7.9%)     1685.13      (9.7%)   -1.9% ( -18% -   16%) 0.485
            BrowseDateSSDVFacets        1.37     (11.3%)        1.34      (8.0%)   -1.9% ( -19% -   19%) 0.540
                         Prefix3      757.89     (12.3%)      743.60     (11.9%)   -1.9% ( -23% -   25%) 0.622
                     MedSpanNear      158.17      (8.0%)      155.19      (9.8%)   -1.9% ( -18% -   17%) 0.507
                HighSloppyPhrase      102.39     (12.2%)      100.48      (9.8%)   -1.9% ( -21% -   22%) 0.594
             MedIntervalsOrdered      108.94      (8.4%)      106.92      (7.3%)   -1.9% ( -16% -   15%) 0.454
                    OrHighNotLow     1257.25     (14.2%)     1234.61     (12.9%)   -1.8% ( -25% -   29%) 0.675
                          IntSet      954.94     (14.1%)      939.99     (13.1%)   -1.6% ( -25% -   29%) 0.715
            HighIntervalsOrdered       25.25      (7.8%)       24.93      (8.4%)   -1.3% ( -16% -   16%) 0.619
           HighTermDayOfYearSort      252.55      (8.7%)      249.35      (7.2%)   -1.3% ( -15% -   16%) 0.616
                      HighPhrase      106.83      (7.8%)      105.87      (7.5%)   -0.9% ( -15% -   15%) 0.710
                          IntNRQ      176.03      (8.4%)      174.45      (8.9%)   -0.9% ( -16% -   17%) 0.743
            HighTermTitleBDVSort       51.20      (4.2%)       50.75      (4.4%)   -0.9% (  -9% -    7%) 0.511
                 MedSloppyPhrase       58.62      (4.1%)       58.11      (4.8%)   -0.9% (  -9% -    8%) 0.538
         AndHighMedDayTaxoFacets      147.56      (5.2%)      146.31      (6.2%)   -0.8% ( -11% -   11%) 0.640
                        BM25MSM2       33.33      (7.3%)       33.07      (7.7%)   -0.8% ( -14% -   15%) 0.743
               HighTermTitleSort      133.43      (7.8%)      132.60      (7.0%)   -0.6% ( -14% -   15%) 0.791
       BrowseDayOfYearSSDVFacets        7.21     (14.8%)        7.19     (11.9%)   -0.2% ( -23% -   30%) 0.960
                      TermDTSort      282.78     (11.5%)      282.33     (11.6%)   -0.2% ( -20% -   25%) 0.965
     BrowseRandomLabelSSDVFacets        5.95     (13.9%)        5.94     (14.7%)   -0.1% ( -25% -   33%) 0.979
        AndHighHighDayTaxoFacets       40.68      (5.3%)       40.70      (6.4%)    0.1% ( -11% -   12%) 0.974
                    HighSpanNear       27.66      (6.3%)       27.70      (6.0%)    0.1% ( -11% -   13%) 0.941
            MedTermDayTaxoFacets       34.22      (2.9%)       34.28      (5.2%)    0.2% (  -7% -    8%) 0.903
           BrowseMonthSSDVFacets        7.73     (19.1%)        7.76     (20.8%)    0.4% ( -33% -   49%) 0.946
                 LowSloppyPhrase       58.08      (5.2%)       58.37      (3.3%)    0.5% (  -7% -    9%) 0.717
                       MedPhrase      192.20      (8.4%)      193.37      (7.8%)    0.6% ( -14% -   18%) 0.813
             LowIntervalsOrdered      206.47      (9.8%)      208.12     (10.2%)    0.8% ( -17% -   23%) 0.801
                        PKLookup      418.92      (3.8%)      422.46      (3.9%)    0.8% (  -6% -    8%) 0.488
                     LowSpanNear       55.86      (3.0%)       56.76      (3.2%)    1.6% (  -4% -    8%) 0.102
                       LowPhrase      122.98      (6.5%)      125.30      (6.3%)    1.9% ( -10% -   15%) 0.353
                   OrNotHighHigh      659.85     (15.0%)      699.70     (15.1%)    6.0% ( -20% -   42%) 0.204

@vsop-479

Copy link
Copy Markdown
Contributor Author

@mikemccand I have another idea:
Use Simple64 to batch decode suffix lengths, And binary search unequal-length suffixes in leaf block.
Please see #16407.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:core/codecs module:core/index module:core/store skip-changelog Apply to PRs that don't need a changelog entry, stopping the automated changelog check.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants