Skip to content

Conversation

RamakrishnaChilaka
Copy link
Contributor

@RamakrishnaChilaka RamakrishnaChilaka commented Aug 30, 2025

Description

This PR updates LongHeap from a fixed 2-ary heap to a 3-ary heap (the code is generic with n-ary Heap). The change improves cache locality and reduces heap operations for larger heaps, which improves overall query performance.

Benchmarks

Luceneutil has been run with TopN as 1000 (see mikemccand/luceneutil#357) Benchmark machine: i3.8xlarge

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
     BrowseRandomLabelSSDVFacets        1.59     (13.0%)        1.52      (6.1%)   -4.4% ( -20% -   16%) 0.167
                HighSloppyPhrase       20.10      (9.3%)       19.52      (6.4%)   -2.9% ( -17% -   14%) 0.258
            BrowseDateSSDVFacets        0.51     (10.2%)        0.50     (10.4%)   -2.7% ( -21% -   20%) 0.415
     BrowseRandomLabelTaxoFacets        1.35     (15.1%)        1.32      (3.4%)   -2.4% ( -18% -   18%) 0.495
            BrowseDateTaxoFacets        1.83     (26.1%)        1.79      (9.0%)   -2.3% ( -29% -   44%) 0.705
               HighTermTitleSort       28.52      (2.9%)       27.98      (3.9%)   -1.9% (  -8% -    5%) 0.080
       BrowseDayOfYearTaxoFacets        1.88     (23.8%)        1.85      (9.3%)   -1.6% ( -27% -   41%) 0.777
            HighIntervalsOrdered        5.14      (6.0%)        5.08      (5.8%)   -1.2% ( -12% -   11%) 0.502
                     LowSpanNear       24.52      (6.3%)       24.29      (7.8%)   -0.9% ( -14% -   14%) 0.676
        AndHighHighDayTaxoFacets       19.61      (4.6%)       19.48      (5.2%)   -0.7% ( -10% -    9%) 0.673
           BrowseMonthTaxoFacets        1.96      (6.1%)        1.94      (6.3%)   -0.6% ( -12% -   12%) 0.748
            HighTermTitleBDVSort        6.95      (5.0%)        6.92      (5.8%)   -0.5% ( -10% -   10%) 0.785
                      TermDTSort       51.57      (4.6%)       51.36      (5.1%)   -0.4% (  -9% -    9%) 0.787
             LowIntervalsOrdered       72.91     (12.9%)       72.63     (15.0%)   -0.4% ( -25% -   31%) 0.933
             MedIntervalsOrdered        4.67      (5.2%)        4.66      (6.4%)   -0.3% ( -11% -   11%) 0.854
         AndHighMedDayTaxoFacets       27.57      (3.5%)       27.60      (3.9%)    0.1% (  -7% -    7%) 0.912
                 MedSloppyPhrase       11.49      (2.9%)       11.54      (2.7%)    0.4% (  -5% -    6%) 0.649
                      AndHighLow      676.59      (5.6%)      680.20      (4.4%)    0.5% (  -8% -   11%) 0.738
           HighTermDayOfYearSort       48.85      (6.8%)       49.18      (6.3%)    0.7% ( -11% -   14%) 0.748
                       LowPhrase       48.95      (4.5%)       49.52      (4.9%)    1.2% (  -7% -   11%) 0.429
          OrHighMedDayTaxoFacets        4.62      (7.1%)        4.68      (5.5%)    1.3% ( -10% -   14%) 0.512
                         Respell       21.00      (8.2%)       21.28      (6.3%)    1.3% ( -12% -   17%) 0.566
                 LowSloppyPhrase       18.02      (8.2%)       18.39      (6.0%)    2.0% ( -11% -   17%) 0.373
                      HighPhrase       26.79      (3.0%)       27.35      (2.5%)    2.1% (  -3% -    7%) 0.015
       BrowseDayOfYearSSDVFacets        2.44     (13.5%)        2.49     (10.8%)    2.2% ( -19% -   30%) 0.565
                          IntNRQ      124.80      (2.6%)      127.62      (2.7%)    2.3% (  -2% -    7%) 0.006
                     MedSpanNear       71.89      (3.3%)       73.63      (2.9%)    2.4% (  -3% -    8%) 0.014
                           range     2418.26      (7.8%)     2481.43      (6.2%)    2.6% ( -10% -   18%) 0.242
                          Fuzzy2       32.82      (6.2%)       33.72      (7.9%)    2.7% ( -10% -   17%) 0.222
                        PKLookup      124.86      (9.3%)      128.39      (9.8%)    2.8% ( -14% -   24%) 0.350
               HighTermMonthSort      109.23     (10.0%)      112.66     (11.5%)    3.1% ( -16% -   27%) 0.355
                    HighSpanNear       12.77     (10.1%)       13.23      (7.0%)    3.6% ( -12% -   23%) 0.189
            MedTermDayTaxoFacets       23.20      (7.2%)       24.08      (3.9%)    3.8% (  -6% -   16%) 0.039
                          IntSet      319.40      (7.9%)      332.99      (7.0%)    4.3% (  -9% -   20%) 0.070
                   OrHighNotHigh       63.45     (12.0%)       66.16     (11.1%)    4.3% ( -16% -   31%) 0.242
                    OrNotHighLow      653.14      (4.5%)      681.44      (5.5%)    4.3% (  -5% -   15%) 0.007
                          Fuzzy1       33.92      (9.6%)       35.47      (8.8%)    4.6% ( -12% -   25%) 0.116
                     AndHighHigh       72.73     (11.4%)       76.10     (12.0%)    4.6% ( -16% -   31%) 0.210
                        Wildcard      162.20      (3.9%)      169.92      (3.7%)    4.8% (  -2% -   12%) 0.000
                       MedPhrase      105.75      (5.3%)      111.28      (6.2%)    5.2% (  -5% -   17%) 0.004
                      AndHighMed      300.00      (3.5%)      317.31      (3.5%)    5.8% (  -1% -   13%) 0.000
                      OrHighHigh       81.99     (10.0%)       86.95     (11.8%)    6.1% ( -14% -   30%) 0.080
                   OrNotHighHigh       94.63      (8.0%)      100.89      (8.5%)    6.6% (  -9% -   25%) 0.011
                    OrNotHighMed      156.93      (5.2%)      167.46      (5.7%)    6.7% (  -3% -   18%) 0.000
                    OrHighNotLow      109.84     (12.4%)      118.15     (13.7%)    7.6% ( -16% -   38%) 0.067
                         Prefix3      298.72      (4.6%)      321.96      (4.8%)    7.8% (  -1% -   17%) 0.000
           BrowseMonthSSDVFacets        2.46      (8.4%)        2.66     (17.5%)    8.0% ( -16% -   37%) 0.066
                       OrHighMed      135.37      (5.3%)      147.30      (8.0%)    8.8% (  -4% -   23%) 0.000
                        HighTerm      169.55     (10.9%)      189.84     (15.3%)   12.0% ( -12% -   42%) 0.004
                       OrHighLow      182.04      (8.5%)      203.99     (10.4%)   12.1% (  -6% -   33%) 0.000
                         MedTerm      257.50      (9.8%)      297.02     (14.4%)   15.4% (  -8% -   43%) 0.000
                    OrHighNotMed      215.73      (6.5%)      249.31      (9.1%)   15.6% (   0% -   33%) 0.000
                         LowTerm      411.97      (8.6%)      481.02     (13.4%)   16.8% (  -4% -   42%) 0.000

Copy link
Contributor

This PR does not have an entry in lucene/CHANGES.txt. Consider adding one. If the PR doesn't need a changelog entry, then add the skip-changelog label to it and you will stop receiving this reminder on future updates to the PR.

@github-actions github-actions bot added this to the 10.3.0 milestone Aug 30, 2025
@jpountz
Copy link
Contributor

jpountz commented Aug 30, 2025

Fascinating! Did you just confirm that 3 performs better than 2, or were you also able to confirm that 3 works better than 4 or 5?

@RamakrishnaChilaka
Copy link
Contributor Author

Thanks for checking the PR, Adrian!

So far I’ve only benchmarked 2-ary vs 3-ary. I haven’t run comparisons against 4 or 5 yet, but I’ll add those runs and share the results here

@jpountz
Copy link
Contributor

jpountz commented Aug 30, 2025

Hmm I tried to reproduce with wikibigall on my machine (AMD Ryzen 9 3900X), but luceneutil reports no speedup (nor slowdown).

@RamakrishnaChilaka
Copy link
Contributor Author

RamakrishnaChilaka commented Aug 31, 2025

I ran additional benchmarks for arity=4 and arity=5 on an i3.8xlarge EC2 instance with wikibigall with topN as 1000.

With arity: 4

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
           BrowseMonthTaxoFacets        2.11     (15.6%)        1.97      (8.6%)   -6.8% ( -26% -   20%) 0.090
                      AndHighLow      702.46      (4.8%)      679.44      (4.3%)   -3.3% ( -11% -    6%) 0.023
                           range     2588.42      (4.5%)     2510.42      (5.1%)   -3.0% ( -12% -    6%) 0.048
                        PKLookup      134.01      (9.4%)      130.17      (9.8%)   -2.9% ( -20% -   18%) 0.346
           BrowseMonthSSDVFacets        2.73     (14.2%)        2.68     (14.1%)   -1.9% ( -26% -   30%) 0.665
                          Fuzzy1       34.06      (4.1%)       33.45      (6.6%)   -1.8% ( -11% -    9%) 0.300
            HighIntervalsOrdered       11.29      (7.5%)       11.09      (6.9%)   -1.8% ( -15% -   13%) 0.438
            MedTermDayTaxoFacets       22.42      (3.6%)       22.03      (3.9%)   -1.8% (  -8% -    5%) 0.139
          OrHighMedDayTaxoFacets        7.03      (3.6%)        6.93      (4.0%)   -1.5% (  -8% -    6%) 0.205
                HighSloppyPhrase       11.25     (10.0%)       11.09     (12.5%)   -1.4% ( -21% -   23%) 0.703
       BrowseDayOfYearSSDVFacets        2.54      (7.4%)        2.50      (9.1%)   -1.3% ( -16% -   16%) 0.618
     BrowseRandomLabelSSDVFacets        1.62      (5.6%)        1.60      (6.4%)   -0.9% ( -12% -   11%) 0.642
     BrowseRandomLabelTaxoFacets        1.38      (3.6%)        1.37      (2.1%)   -0.8% (  -6% -    5%) 0.383
                       MedPhrase       27.46      (5.7%)       27.28      (6.3%)   -0.7% ( -11% -   12%) 0.727
             LowIntervalsOrdered      114.31     (10.3%)      113.73     (10.1%)   -0.5% ( -19% -   22%) 0.875
                      TermDTSort       49.04      (5.9%)       49.00      (4.6%)   -0.1% ( -10% -   11%) 0.969
               HighTermTitleSort       15.19      (2.3%)       15.21      (2.1%)    0.1% (  -4% -    4%) 0.853
            HighTermTitleBDVSort       19.89      (4.0%)       19.92      (2.1%)    0.2% (  -5% -    6%) 0.877
                         Respell       18.67      (6.9%)       18.70      (6.9%)    0.2% ( -12% -   15%) 0.928
         AndHighMedDayTaxoFacets       16.22      (2.9%)       16.26      (4.2%)    0.3% (  -6% -    7%) 0.804
                     MedSpanNear       14.25      (3.4%)       14.30      (3.6%)    0.4% (  -6% -    7%) 0.750
                    HighSpanNear       18.10      (5.6%)       18.17      (5.6%)    0.4% ( -10% -   12%) 0.822
        AndHighHighDayTaxoFacets       26.22      (3.2%)       26.38      (3.5%)    0.6% (  -5% -    7%) 0.560
            BrowseDateTaxoFacets        1.82      (9.3%)        1.84      (9.1%)    0.6% ( -16% -   21%) 0.830
                      HighPhrase       24.78      (5.0%)       24.99      (5.5%)    0.8% (  -9% -   11%) 0.621
                      OrHighHigh       54.07     (13.2%)       54.57     (14.9%)    0.9% ( -23% -   33%) 0.834
                 MedSloppyPhrase       40.49     (11.4%)       40.95      (8.0%)    1.1% ( -16% -   23%) 0.716
       BrowseDayOfYearTaxoFacets        1.87      (8.9%)        1.90      (8.6%)    1.6% ( -14% -   20%) 0.563
           HighTermDayOfYearSort       49.93      (4.7%)       50.76      (5.4%)    1.7% (  -8% -   12%) 0.298
                 LowSloppyPhrase       33.61      (4.2%)       34.34      (3.6%)    2.2% (  -5% -   10%) 0.076
                          IntSet      342.14      (5.0%)      350.17      (8.2%)    2.3% ( -10% -   16%) 0.274
                          Fuzzy2       38.24      (7.0%)       39.16      (8.8%)    2.4% ( -12% -   19%) 0.338
                       LowPhrase       81.34      (5.1%)       83.44      (6.7%)    2.6% (  -8% -   15%) 0.167
               HighTermMonthSort      124.62     (10.0%)      128.55      (8.6%)    3.2% ( -14% -   24%) 0.286
                   OrNotHighHigh      126.56      (9.3%)      131.11      (7.3%)    3.6% ( -11% -   22%) 0.173
                     AndHighHigh      110.96      (9.5%)      115.01     (10.4%)    3.7% ( -14% -   26%) 0.246
             MedIntervalsOrdered       36.48     (11.4%)       37.82     (10.3%)    3.7% ( -16% -   28%) 0.284
                      AndHighMed      331.48      (4.2%)      346.49      (3.3%)    4.5% (  -2% -   12%) 0.000
                   OrHighNotHigh       65.15     (10.0%)       68.40     (10.8%)    5.0% ( -14% -   28%) 0.130
                    OrHighNotMed      104.28     (11.8%)      109.63     (12.0%)    5.1% ( -16% -   32%) 0.173
                    OrNotHighMed      111.32      (8.0%)      117.42      (7.1%)    5.5% (  -8% -   22%) 0.021
                       OrHighLow      133.57     (11.5%)      141.84     (12.3%)    6.2% ( -15% -   33%) 0.099
                     LowSpanNear      116.39      (5.8%)      123.65      (9.6%)    6.2% (  -8% -   22%) 0.013
                          IntNRQ      401.26      (3.3%)      434.67      (4.3%)    8.3% (   0% -   16%) 0.000
            BrowseDateSSDVFacets        0.51     (11.3%)        0.55     (11.8%)    8.5% ( -13% -   35%) 0.021
                    OrHighNotLow      184.23     (12.8%)      200.08     (15.6%)    8.6% ( -17% -   42%) 0.057
                       OrHighMed      154.37      (6.9%)      167.71      (8.8%)    8.6% (  -6% -   26%) 0.001
                        HighTerm      193.83     (13.1%)      211.10     (18.2%)    8.9% ( -19% -   46%) 0.075
                        Wildcard      344.97      (6.0%)      376.99      (5.9%)    9.3% (  -2% -   22%) 0.000
                    OrNotHighLow      523.48      (5.6%)      572.78      (4.7%)    9.4% (   0% -   20%) 0.000
                         MedTerm      272.87     (12.8%)      303.38     (14.8%)   11.2% ( -14% -   44%) 0.011
                         Prefix3      346.15      (5.1%)      388.11      (7.0%)   12.1% (   0% -   25%) 0.000
                         LowTerm      424.14     (11.2%)      489.13     (17.5%)   15.3% ( -12% -   49%) 0.001

With arity: 5

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
          OrHighMedDayTaxoFacets        7.52      (6.1%)        7.22      (6.2%)   -3.9% ( -15% -    8%) 0.044
                      AndHighLow      918.22      (4.1%)      893.49      (3.3%)   -2.7% (  -9% -    4%) 0.022
                        PKLookup      131.07      (8.9%)      128.88     (13.7%)   -1.7% ( -22% -   22%) 0.647
     BrowseRandomLabelSSDVFacets        1.54      (8.9%)        1.51      (4.8%)   -1.6% ( -13% -   13%) 0.479
           HighTermDayOfYearSort       52.05      (5.2%)       51.47      (4.9%)   -1.1% ( -10% -    9%) 0.489
         AndHighMedDayTaxoFacets       71.07      (4.5%)       70.32      (6.2%)   -1.1% ( -11% -   10%) 0.535
                     LowSpanNear       23.05      (8.5%)       22.83      (7.8%)   -1.0% ( -15% -   16%) 0.703
           BrowseMonthTaxoFacets        1.96      (5.9%)        1.94      (8.1%)   -1.0% ( -14% -   13%) 0.664
        AndHighHighDayTaxoFacets       21.41      (4.8%)       21.21      (4.4%)   -1.0% (  -9% -    8%) 0.505
               HighTermTitleSort       21.28      (4.0%)       21.10      (3.7%)   -0.8% (  -8% -    7%) 0.507
                          Fuzzy1       45.08      (5.8%)       44.73      (8.4%)   -0.8% ( -14% -   14%) 0.731
            MedTermDayTaxoFacets       22.36      (5.2%)       22.23      (5.3%)   -0.6% ( -10% -   10%) 0.719
                 MedSloppyPhrase       18.25      (5.0%)       18.26      (6.0%)    0.0% ( -10% -   11%) 0.980
                HighSloppyPhrase       13.64      (6.5%)       13.72      (4.4%)    0.6% (  -9% -   12%) 0.737
                 LowSloppyPhrase       27.60      (6.7%)       27.78      (4.3%)    0.6% (  -9% -   12%) 0.713
       BrowseDayOfYearTaxoFacets        1.87      (8.5%)        1.88     (19.0%)    0.7% ( -24% -   30%) 0.886
                     MedSpanNear       14.28      (5.0%)       14.39      (4.4%)    0.7% (  -8% -   10%) 0.617
                      TermDTSort       51.11      (6.1%)       51.50      (7.6%)    0.8% ( -12% -   15%) 0.729
            HighIntervalsOrdered       10.27      (8.8%)       10.35      (9.4%)    0.8% ( -15% -   20%) 0.784
             LowIntervalsOrdered       43.86      (3.3%)       44.23      (3.4%)    0.9% (  -5% -    7%) 0.419
                       MedPhrase       67.55      (4.1%)       68.30      (4.5%)    1.1% (  -7% -   10%) 0.413
                    HighSpanNear       12.38      (2.4%)       12.53      (3.6%)    1.2% (  -4% -    7%) 0.214
     BrowseRandomLabelTaxoFacets        1.35      (3.6%)        1.37     (11.8%)    1.2% ( -13% -   17%) 0.652
            BrowseDateTaxoFacets        1.81      (9.8%)        1.84     (18.4%)    1.5% ( -24% -   32%) 0.742
               HighTermMonthSort      128.37     (11.1%)      130.37     (10.6%)    1.6% ( -18% -   26%) 0.650
             MedIntervalsOrdered       38.78     (10.2%)       39.43      (8.3%)    1.7% ( -15% -   22%) 0.564
                          Fuzzy2       35.57      (7.0%)       36.22      (8.7%)    1.8% ( -12% -   18%) 0.462
                           range     2331.03      (7.0%)     2380.31      (6.2%)    2.1% ( -10% -   16%) 0.312
                      HighPhrase       26.01      (2.2%)       26.60      (2.5%)    2.3% (  -2% -    7%) 0.002
                   OrNotHighHigh       69.94      (9.9%)       71.71     (10.4%)    2.5% ( -16% -   25%) 0.433
                          IntNRQ      251.37      (2.3%)      258.93      (2.7%)    3.0% (  -2% -    8%) 0.000
                   OrHighNotHigh       86.47      (8.6%)       89.21      (9.6%)    3.2% ( -13% -   23%) 0.271
                       LowPhrase      118.43      (3.0%)      122.61      (3.6%)    3.5% (  -3% -   10%) 0.001
            HighTermTitleBDVSort        7.52      (5.2%)        7.80      (5.8%)    3.7% (  -6% -   15%) 0.032
                     AndHighHigh       56.42      (9.7%)       58.54     (11.8%)    3.8% ( -16% -   27%) 0.272
           BrowseMonthSSDVFacets        2.59     (13.1%)        2.69     (23.1%)    3.8% ( -28% -   45%) 0.525
            BrowseDateSSDVFacets        0.52     (11.1%)        0.55     (10.5%)    4.4% ( -15% -   29%) 0.194
                         Respell       27.39      (8.8%)       28.64      (7.3%)    4.5% ( -10% -   22%) 0.075
                      AndHighMed      157.72      (6.9%)      165.18      (7.4%)    4.7% (  -8% -   20%) 0.036
                      OrHighHigh       59.00      (8.6%)       61.81      (7.1%)    4.8% ( -10% -   22%) 0.056
                    OrNotHighLow      509.65      (4.5%)      534.12      (6.1%)    4.8% (  -5% -   16%) 0.005
       BrowseDayOfYearSSDVFacets        2.51     (15.6%)        2.64     (20.1%)    5.2% ( -26% -   48%) 0.357
                          IntSet      350.80      (8.0%)      373.67      (6.4%)    6.5% (  -7% -   22%) 0.004
                        Wildcard      215.02      (4.5%)      230.84      (5.6%)    7.4% (  -2% -   18%) 0.000
                       OrHighMed      133.16      (5.9%)      144.00      (4.2%)    8.1% (  -1% -   19%) 0.000
                       OrHighLow      141.79      (8.9%)      153.40     (11.2%)    8.2% ( -10% -   31%) 0.010
                    OrNotHighMed      186.12      (4.9%)      201.54      (6.1%)    8.3% (  -2% -   20%) 0.000
                    OrHighNotMed      139.20      (8.5%)      150.98     (11.5%)    8.5% ( -10% -   31%) 0.008
                    OrHighNotLow      163.68      (8.6%)      181.52     (10.7%)   10.9% (  -7% -   33%) 0.000
                         Prefix3      409.57      (6.0%)      461.76      (7.9%)   12.7% (  -1% -   28%) 0.000
                        HighTerm      210.94      (9.6%)      242.76     (10.5%)   15.1% (  -4% -   38%) 0.000
                         MedTerm      258.25      (7.6%)      305.79      (8.9%)   18.4% (   1% -   37%) 0.000
                         LowTerm      420.58      (9.4%)      510.49     (10.7%)   21.4% (   1% -   45%) 0.000

@RamakrishnaChilaka
Copy link
Contributor Author

RamakrishnaChilaka commented Aug 31, 2025

Reran benchmarks with arity 3

Run-1

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                        PKLookup      112.57      (9.9%)      105.75      (7.8%)   -6.1% ( -21% -   12%) 0.032
           BrowseMonthTaxoFacets        1.55      (9.8%)        1.51      (9.8%)   -2.9% ( -20% -   18%) 0.353
               HighTermTitleSort       21.94      (7.6%)       21.35      (9.7%)   -2.7% ( -18% -   15%) 0.328
                           range     1988.08      (7.4%)     1937.90      (7.5%)   -2.5% ( -16% -   13%) 0.284
                      AndHighLow      578.51      (6.5%)      566.10      (6.6%)   -2.1% ( -14% -   11%) 0.301
                HighSloppyPhrase        0.47      (6.7%)        0.46      (7.0%)   -1.7% ( -14% -   12%) 0.419
          OrHighMedDayTaxoFacets        2.07      (7.6%)        2.04      (6.0%)   -1.5% ( -14% -   13%) 0.486
     BrowseRandomLabelTaxoFacets        1.11      (5.9%)        1.10      (7.6%)   -0.6% ( -13% -   13%) 0.771
                         Respell       18.55      (7.2%)       18.44      (4.9%)   -0.6% ( -11% -   12%) 0.772
            MedTermDayTaxoFacets       19.47      (3.2%)       19.37      (3.0%)   -0.5% (  -6% -    5%) 0.580
                      HighPhrase       13.08      (4.8%)       13.06      (5.1%)   -0.1% (  -9% -   10%) 0.924
                     LowSpanNear       33.87      (4.7%)       33.85      (4.9%)   -0.1% (  -9% -    9%) 0.963
         AndHighMedDayTaxoFacets      107.22      (3.9%)      107.31      (2.9%)    0.1% (  -6% -    7%) 0.939
            HighTermTitleBDVSort       14.65      (4.0%)       14.66      (4.3%)    0.1% (  -7% -    8%) 0.931
           HighTermDayOfYearSort       45.00      (5.1%)       45.06      (5.5%)    0.1% ( -10% -   11%) 0.935
            HighIntervalsOrdered       18.87      (7.1%)       18.90      (8.5%)    0.1% ( -14% -   16%) 0.953
        AndHighHighDayTaxoFacets        6.24      (5.1%)        6.25      (4.5%)    0.2% (  -8% -   10%) 0.901
                      TermDTSort       43.90      (6.8%)       44.17      (7.5%)    0.6% ( -12% -   16%) 0.787
       BrowseDayOfYearTaxoFacets        1.50      (8.7%)        1.52     (12.0%)    1.3% ( -17% -   24%) 0.699
                 LowSloppyPhrase       49.24      (3.8%)       49.90      (6.3%)    1.3% (  -8% -   11%) 0.415
             LowIntervalsOrdered      108.45      (5.2%)      109.91      (7.4%)    1.3% ( -10% -   14%) 0.507
                     AndHighHigh       80.95     (11.3%)       82.26     (12.0%)    1.6% ( -19% -   28%) 0.662
                      OrHighHigh       64.43     (12.6%)       65.50     (14.3%)    1.7% ( -22% -   32%) 0.698
                    HighSpanNear       10.63      (4.7%)       10.83      (5.3%)    1.8% (  -7% -   12%) 0.254
                 MedSloppyPhrase       39.59     (14.4%)       40.35     (11.9%)    1.9% ( -21% -   33%) 0.649
                          IntNRQ      198.78      (4.5%)      202.61      (7.0%)    1.9% (  -9% -   14%) 0.302
                       MedPhrase       56.91      (2.7%)       58.01      (4.9%)    1.9% (  -5% -    9%) 0.121
            BrowseDateSSDVFacets        0.41     (11.6%)        0.42     (10.8%)    2.0% ( -18% -   27%) 0.572
             MedIntervalsOrdered       36.71      (4.5%)       37.45      (4.4%)    2.0% (  -6% -   11%) 0.154
     BrowseRandomLabelSSDVFacets        1.27      (7.6%)        1.31      (8.7%)    2.6% ( -12% -   20%) 0.308
                        Wildcard      161.19      (7.4%)      165.48      (8.2%)    2.7% ( -12% -   19%) 0.280
                         Prefix3      219.37      (5.6%)      225.28      (6.3%)    2.7% (  -8% -   15%) 0.155
       BrowseDayOfYearSSDVFacets        2.08     (14.6%)        2.14     (13.1%)    2.7% ( -21% -   35%) 0.533
                    OrNotHighMed       60.56      (7.0%)       62.25      (6.8%)    2.8% ( -10% -   17%) 0.202
                     MedSpanNear       81.72      (3.7%)       84.06      (4.8%)    2.9% (  -5% -   11%) 0.035
                          Fuzzy2       21.39      (4.1%)       22.02      (5.1%)    2.9% (  -5% -   12%) 0.044
                          Fuzzy1       27.20      (6.0%)       28.05     (10.3%)    3.1% ( -12% -   20%) 0.242
                   OrHighNotHigh       80.30     (11.7%)       83.06     (11.6%)    3.4% ( -17% -   30%) 0.353
               HighTermMonthSort       85.65      (7.5%)       88.62     (11.8%)    3.5% ( -14% -   24%) 0.268
                      AndHighMed      204.92     (10.9%)      212.49     (11.4%)    3.7% ( -16% -   29%) 0.295
                   OrNotHighHigh       94.39      (8.5%)       97.93      (9.9%)    3.7% ( -13% -   24%) 0.200
                       LowPhrase      121.30      (3.8%)      126.06      (5.2%)    3.9% (  -4% -   13%) 0.006
                    OrHighNotMed      134.97     (12.0%)      140.59     (13.2%)    4.2% ( -18% -   33%) 0.296
           BrowseMonthSSDVFacets        2.11     (11.5%)        2.23     (17.1%)    5.7% ( -20% -   38%) 0.219
            BrowseDateTaxoFacets        1.40      (5.9%)        1.49     (15.8%)    5.8% ( -14% -   29%) 0.123
                       OrHighLow      122.42      (9.9%)      129.57     (12.4%)    5.8% ( -14% -   31%) 0.099
                          IntSet      276.23      (7.6%)      293.37      (7.9%)    6.2% (  -8% -   23%) 0.011
                         MedTerm      174.33     (14.5%)      187.06     (17.4%)    7.3% ( -21% -   45%) 0.149
                    OrNotHighLow      355.78      (6.5%)      382.90      (6.5%)    7.6% (  -5% -   22%) 0.000
                        HighTerm      161.21     (14.0%)      173.70     (17.6%)    7.8% ( -20% -   45%) 0.124
                       OrHighMed      129.57      (7.2%)      139.74      (9.6%)    7.8% (  -8% -   26%) 0.003
                    OrHighNotLow      208.81      (7.5%)      236.41     (12.8%)   13.2% (  -6% -   36%) 0.000
                         LowTerm      352.74     (13.3%)      399.51     (17.0%)   13.3% ( -15% -   50%) 0.006

Run-2

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
           BrowseMonthSSDVFacets        2.72     (23.8%)        2.47     (13.0%)   -9.2% ( -37% -   36%) 0.129
       BrowseDayOfYearTaxoFacets        1.86     (17.8%)        1.79      (8.9%)   -3.9% ( -25% -   27%) 0.386
            BrowseDateTaxoFacets        1.79     (18.3%)        1.73      (9.3%)   -3.3% ( -26% -   29%) 0.474
     BrowseRandomLabelTaxoFacets        1.33     (12.6%)        1.29      (3.5%)   -2.8% ( -16% -   15%) 0.348
                      AndHighLow      762.29      (4.9%)      744.22      (4.5%)   -2.4% ( -11% -    7%) 0.111
           BrowseMonthTaxoFacets        1.82      (8.4%)        1.79      (8.6%)   -2.1% ( -17% -   16%) 0.442
            BrowseDateSSDVFacets        0.49     (10.3%)        0.49     (10.2%)   -1.5% ( -19% -   21%) 0.653
       BrowseDayOfYearSSDVFacets        2.28     (13.8%)        2.25      (8.8%)   -1.4% ( -21% -   24%) 0.708
            MedTermDayTaxoFacets        9.06      (7.1%)        8.95      (6.3%)   -1.2% ( -13% -   13%) 0.572
                 LowSloppyPhrase        6.34      (4.4%)        6.28      (5.5%)   -0.9% ( -10% -    9%) 0.579
                HighSloppyPhrase        6.30      (3.9%)        6.27      (4.4%)   -0.5% (  -8% -    8%) 0.694
                 MedSloppyPhrase       37.11      (4.2%)       37.01      (5.3%)   -0.3% (  -9% -    9%) 0.863
                      TermDTSort       51.26      (8.1%)       51.18      (7.7%)   -0.2% ( -14% -   17%) 0.952
                       LowPhrase       14.99      (3.0%)       14.97      (2.2%)   -0.1% (  -5% -    5%) 0.860
                    HighSpanNear       17.12      (5.0%)       17.12      (4.3%)   -0.0% (  -8% -    9%) 0.995
                          Fuzzy1       33.24      (8.1%)       33.27      (7.8%)    0.1% ( -14% -   17%) 0.979
            HighTermTitleBDVSort       15.84      (3.7%)       15.85      (5.4%)    0.1% (  -8% -    9%) 0.953
     BrowseRandomLabelSSDVFacets        1.53     (12.3%)        1.53     (13.5%)    0.2% ( -22% -   29%) 0.954
               HighTermTitleSort       22.83      (2.8%)       22.89      (3.5%)    0.3% (  -5% -    6%) 0.803
                        Wildcard       32.78      (3.5%)       33.01      (3.6%)    0.7% (  -6% -    8%) 0.530
             MedIntervalsOrdered       14.18      (5.1%)       14.31      (4.7%)    0.9% (  -8% -   11%) 0.560
        AndHighHighDayTaxoFacets        9.41      (5.4%)        9.50      (5.9%)    0.9% (  -9% -   12%) 0.606
                     LowSpanNear       61.70     (16.1%)       62.34     (15.0%)    1.0% ( -25% -   38%) 0.833
                     MedSpanNear       48.89      (1.8%)       49.44      (2.0%)    1.1% (  -2% -    5%) 0.065
         AndHighMedDayTaxoFacets       49.56      (6.1%)       50.35      (7.8%)    1.6% ( -11% -   16%) 0.471
                        PKLookup      124.61     (12.0%)      126.63     (10.5%)    1.6% ( -18% -   27%) 0.650
                          Fuzzy2       24.69      (8.7%)       25.18     (10.4%)    2.0% ( -15% -   23%) 0.514
                    OrNotHighMed       63.50      (8.9%)       64.76      (8.8%)    2.0% ( -14% -   21%) 0.477
          OrHighMedDayTaxoFacets        1.27      (6.9%)        1.29      (7.1%)    2.1% ( -11% -   17%) 0.340
                          IntNRQ      148.27      (2.9%)      151.77      (3.6%)    2.4% (  -4% -    9%) 0.024
               HighTermMonthSort      104.77     (11.7%)      107.31     (13.2%)    2.4% ( -20% -   30%) 0.539
                           range     2289.72      (6.2%)     2348.60      (7.7%)    2.6% ( -10% -   17%) 0.245
             LowIntervalsOrdered       40.47      (9.0%)       41.57      (8.9%)    2.7% ( -13% -   22%) 0.334
                      HighPhrase       49.04      (2.9%)       50.51      (3.4%)    3.0% (  -3% -    9%) 0.002
           HighTermDayOfYearSort       45.45      (5.5%)       46.94      (7.7%)    3.3% (  -9% -   17%) 0.119
                       MedPhrase      107.74      (3.2%)      111.57      (5.3%)    3.6% (  -4% -   12%) 0.011
                         Respell       19.79      (8.8%)       20.72      (8.5%)    4.7% ( -11% -   24%) 0.085
                      OrHighHigh       64.95     (10.2%)       68.01     (12.4%)    4.7% ( -16% -   30%) 0.189
            HighIntervalsOrdered        5.45      (7.3%)        5.72      (8.7%)    4.8% ( -10% -   22%) 0.058
                         Prefix3      280.79      (4.7%)      296.12      (6.0%)    5.5% (  -4% -   16%) 0.001
                     AndHighHigh       86.17      (8.9%)       91.44      (9.4%)    6.1% ( -11% -   26%) 0.035
                   OrHighNotHigh      112.65      (7.4%)      119.54      (7.6%)    6.1% (  -8% -   22%) 0.010
                    OrHighNotMed      101.20     (10.1%)      108.33     (11.5%)    7.0% ( -13% -   31%) 0.039
                   OrNotHighHigh      145.86      (7.7%)      156.14     (10.2%)    7.0% ( -10% -   27%) 0.014
                          IntSet      296.50      (6.5%)      319.58      (6.4%)    7.8% (  -4% -   22%) 0.000
                      AndHighMed      215.53      (4.7%)      234.06      (5.5%)    8.6% (  -1% -   19%) 0.000
                       OrHighMed      137.15      (5.9%)      149.35      (8.8%)    8.9% (  -5% -   25%) 0.000
                       OrHighLow      141.05      (9.3%)      153.64     (12.9%)    8.9% ( -12% -   34%) 0.012
                    OrNotHighLow      444.63      (6.1%)      485.27      (7.6%)    9.1% (  -4% -   24%) 0.000
                         MedTerm      215.15     (11.9%)      238.53     (14.3%)   10.9% ( -13% -   42%) 0.009
                        HighTerm      193.54     (11.8%)      215.13     (14.8%)   11.2% ( -13% -   42%) 0.008
                    OrHighNotLow      157.06     (10.4%)      175.22     (14.9%)   11.6% ( -12% -   41%) 0.004
                         LowTerm      488.98     (10.3%)      577.50     (14.9%)   18.1% (  -6% -   48%) 0.000

@RamakrishnaChilaka
Copy link
Contributor Author

RamakrishnaChilaka commented Aug 31, 2025

Hmm I tried to reproduce with wikibigall on my machine (AMD Ryzen 9 3900X), but luceneutil reports no speedup (nor slowdown).

Thank you for running the cross-check, Adrian.
Since the i3.8xlarge (Intel Xeon E5-2686 v4 (Broadwell)) gains disappear on Ryzen 9.

I’ll re-run the same wikibigall suite on a second (graviton) instance I have access to.

@RamakrishnaChilaka
Copy link
Contributor Author

Ran benchmarks on c8g.8xlarge (graviton) instance.

arity-3

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
            BrowseDateTaxoFacets        4.40     (18.9%)        4.06     (14.3%)   -7.8% ( -34% -   31%) 0.142
       BrowseDayOfYearTaxoFacets        4.39     (18.1%)        4.05     (13.8%)   -7.7% ( -33% -   29%) 0.132
       BrowseDayOfYearSSDVFacets        5.53     (11.8%)        5.22      (7.7%)   -5.7% ( -22% -   15%) 0.070
     BrowseRandomLabelTaxoFacets        3.21     (12.0%)        3.05      (8.9%)   -5.0% ( -23% -   18%) 0.137
     BrowseRandomLabelSSDVFacets        4.27     (11.6%)        4.17     (10.1%)   -2.5% ( -21% -   21%) 0.467
               HighTermMonthSort      239.78      (5.8%)      237.72      (4.7%)   -0.9% ( -10% -   10%) 0.607
            HighTermTitleBDVSort       44.65      (1.7%)       44.29      (1.4%)   -0.8% (  -3% -    2%) 0.102
                        PKLookup      248.25      (2.2%)      247.20      (3.2%)   -0.4% (  -5% -    5%) 0.623
               HighTermTitleSort       87.91      (2.8%)       87.58      (2.8%)   -0.4% (  -5% -    5%) 0.670
                      AndHighLow     1536.38      (3.0%)     1531.14      (2.7%)   -0.3% (  -5% -    5%) 0.707
        AndHighHighDayTaxoFacets       21.59      (1.9%)       21.54      (1.8%)   -0.2% (  -3% -    3%) 0.712
             MedIntervalsOrdered       13.44      (9.3%)       13.43      (8.9%)   -0.1% ( -16% -   19%) 0.966
                         Respell       59.42      (1.7%)       59.36      (1.9%)   -0.1% (  -3% -    3%) 0.851
         AndHighMedDayTaxoFacets       61.90      (0.7%)       61.83      (0.9%)   -0.1% (  -1% -    1%) 0.683
                           range     3970.86      (3.6%)     3981.24      (4.9%)    0.3% (  -7% -    9%) 0.847
           BrowseMonthTaxoFacets        3.15      (2.7%)        3.16      (2.9%)    0.4% (  -5% -    6%) 0.653
           HighTermDayOfYearSort      142.15      (3.2%)      142.96      (2.5%)    0.6% (  -4% -    6%) 0.525
                    HighSpanNear       33.18      (3.7%)       33.40      (3.4%)    0.7% (  -6% -    8%) 0.559
                      TermDTSort      138.58      (2.3%)      139.55      (2.5%)    0.7% (  -3% -    5%) 0.351
                     LowSpanNear       18.61      (2.3%)       18.74      (2.0%)    0.7% (  -3% -    5%) 0.295
            HighIntervalsOrdered       42.55      (7.0%)       42.88      (6.5%)    0.8% ( -11% -   15%) 0.717
             LowIntervalsOrdered       52.36      (2.1%)       52.82      (1.8%)    0.9% (  -2% -    4%) 0.158
            MedTermDayTaxoFacets       51.42      (2.6%)       51.93      (2.7%)    1.0% (  -4% -    6%) 0.237
                     MedSpanNear       17.26      (6.6%)       17.43      (5.8%)    1.0% ( -10% -   14%) 0.599
                          Fuzzy2       80.04      (2.2%)       80.90      (2.2%)    1.1% (  -3% -    5%) 0.116
                       MedPhrase       58.45      (2.4%)       59.09      (2.0%)    1.1% (  -3% -    5%) 0.113
                        Wildcard      544.95      (3.4%)      551.96      (3.9%)    1.3% (  -5% -    8%) 0.269
          OrHighMedDayTaxoFacets       11.78      (6.3%)       11.94      (5.2%)    1.4% (  -9% -   13%) 0.441
                HighSloppyPhrase       47.46      (2.5%)       48.14      (3.6%)    1.4% (  -4% -    7%) 0.141
                          Fuzzy1       82.67      (2.2%)       83.95      (2.2%)    1.5% (  -2% -    6%) 0.026
                       LowPhrase      161.42      (1.5%)      163.94      (1.0%)    1.6% (   0% -    4%) 0.000
                          IntNRQ      372.37      (1.8%)      380.36      (2.1%)    2.1% (  -1% -    6%) 0.001
                 LowSloppyPhrase      104.48      (1.9%)      106.80      (1.7%)    2.2% (  -1% -    5%) 0.000
                         Prefix3      901.22      (5.7%)      925.71      (8.1%)    2.7% ( -10% -   17%) 0.221
            BrowseDateSSDVFacets        1.04      (9.7%)        1.07      (9.4%)    2.7% ( -14% -   24%) 0.368
                          IntSet      779.52      (6.5%)      801.15      (5.1%)    2.8% (  -8% -   15%) 0.133
                      HighPhrase       99.20      (1.9%)      101.99      (1.5%)    2.8% (   0% -    6%) 0.000
           BrowseMonthSSDVFacets        5.41     (10.8%)        5.63     (14.4%)    4.0% ( -19% -   32%) 0.321
                 MedSloppyPhrase      218.23      (1.9%)      227.35      (2.3%)    4.2% (   0% -    8%) 0.000
                    OrNotHighLow     1100.00      (2.4%)     1161.75      (2.4%)    5.6% (   0% -   10%) 0.000
                      AndHighMed      323.81      (3.9%)      343.16      (4.1%)    6.0% (  -1% -   14%) 0.000
                   OrNotHighHigh      130.10      (9.1%)      138.82      (7.9%)    6.7% (  -9% -   26%) 0.013
                     AndHighHigh      253.29      (7.9%)      271.17      (7.7%)    7.1% (  -7% -   24%) 0.004
                    OrNotHighMed      355.85      (4.9%)      387.51      (4.6%)    8.9% (   0% -   19%) 0.000
                      OrHighHigh      188.87     (11.7%)      206.67     (11.9%)    9.4% ( -12% -   37%) 0.012
                       OrHighMed      335.86      (3.2%)      370.68      (4.4%)   10.4% (   2% -   18%) 0.000
                   OrHighNotHigh      453.89      (4.7%)      504.08      (5.5%)   11.1% (   0% -   22%) 0.000
                    OrHighNotMed      247.33     (10.9%)      276.47     (10.2%)   11.8% (  -8% -   37%) 0.000
                       OrHighLow      347.23     (10.2%)      395.47     (12.3%)   13.9% (  -7% -   40%) 0.000
                    OrHighNotLow      345.07     (12.7%)      394.73     (13.4%)   14.4% ( -10% -   46%) 0.000
                         LowTerm      810.53      (7.3%)      940.58      (9.0%)   16.0% (   0% -   34%) 0.000
                        HighTerm      373.56     (11.4%)      434.34     (14.6%)   16.3% (  -8% -   47%) 0.000
                         MedTerm      457.24     (10.0%)      533.31     (12.9%)   16.6% (  -5% -   43%) 0.000

arity-4

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                      AndHighLow     1425.61      (3.2%)     1373.91      (1.9%)   -3.6% (  -8% -    1%) 0.000
            BrowseDateSSDVFacets        1.03      (9.8%)        1.01      (9.4%)   -1.7% ( -19% -   19%) 0.569
                           range     2741.78      (7.5%)     2695.25      (8.0%)   -1.7% ( -15% -   14%) 0.489
           BrowseMonthTaxoFacets        3.16      (3.0%)        3.12      (2.3%)   -1.3% (  -6% -    4%) 0.111
           HighTermDayOfYearSort      131.15      (3.9%)      129.63      (2.5%)   -1.2% (  -7% -    5%) 0.266
     BrowseRandomLabelSSDVFacets        4.21      (6.7%)        4.17      (5.8%)   -1.0% ( -12% -   12%) 0.613
           BrowseMonthSSDVFacets        5.60      (9.1%)        5.55      (9.8%)   -1.0% ( -18% -   19%) 0.739
                      TermDTSort      122.31      (3.3%)      121.16      (2.7%)   -0.9% (  -6% -    5%) 0.320
        AndHighHighDayTaxoFacets       30.80      (1.6%)       30.76      (1.4%)   -0.2% (  -3% -    2%) 0.740
                HighSloppyPhrase       17.99      (4.5%)       17.99      (3.7%)   -0.0% (  -7% -    8%) 0.983
         AndHighMedDayTaxoFacets       63.24      (1.2%)       63.27      (1.7%)    0.0% (  -2% -    2%) 0.920
            MedTermDayTaxoFacets       28.49      (1.8%)       28.50      (2.5%)    0.1% (  -4% -    4%) 0.933
                         Respell       55.79      (1.2%)       55.83      (1.2%)    0.1% (  -2% -    2%) 0.858
            HighTermTitleBDVSort       35.33      (2.9%)       35.48      (2.7%)    0.4% (  -4% -    6%) 0.630
                        PKLookup      247.22      (2.6%)      248.30      (2.1%)    0.4% (  -4% -    5%) 0.562
          OrHighMedDayTaxoFacets       14.76      (4.5%)       14.85      (4.7%)    0.6% (  -8% -   10%) 0.675
            HighIntervalsOrdered       66.21      (8.6%)       66.68      (8.8%)    0.7% ( -15% -   19%) 0.797
                 LowSloppyPhrase       64.20      (2.5%)       64.68      (2.3%)    0.7% (  -3% -    5%) 0.331
                      AndHighMed      784.54      (1.7%)      790.69      (2.0%)    0.8% (  -2% -    4%) 0.188
                    HighSpanNear       65.48      (2.4%)       66.05      (3.3%)    0.9% (  -4% -    6%) 0.337
       BrowseDayOfYearSSDVFacets        5.46      (7.0%)        5.51     (10.2%)    0.9% ( -15% -   19%) 0.745
             LowIntervalsOrdered       52.44      (3.7%)       52.92      (3.5%)    0.9% (  -6% -    8%) 0.425
                     MedSpanNear      305.20      (2.4%)      308.38      (3.4%)    1.0% (  -4% -    7%) 0.268
                        Wildcard      462.71      (2.4%)      467.58      (6.0%)    1.1% (  -7% -    9%) 0.467
               HighTermTitleSort       85.75      (2.8%)       86.79      (2.2%)    1.2% (  -3% -    6%) 0.123
             MedIntervalsOrdered       82.17      (2.8%)       83.21      (2.8%)    1.3% (  -4% -    7%) 0.158
                       MedPhrase      207.87      (1.2%)      210.98      (1.4%)    1.5% (  -1% -    4%) 0.000
               HighTermMonthSort      219.20      (4.9%)      222.79      (5.4%)    1.6% (  -8% -   12%) 0.317
                      HighPhrase       56.74      (2.4%)       57.69      (2.7%)    1.7% (  -3% -    6%) 0.036
                          Fuzzy1       91.76      (2.3%)       93.35      (2.8%)    1.7% (  -3% -    6%) 0.031
                 MedSloppyPhrase       86.91      (3.8%)       88.52      (2.9%)    1.9% (  -4% -    8%) 0.080
                          Fuzzy2       77.27      (2.0%)       78.72      (2.3%)    1.9% (  -2% -    6%) 0.006
     BrowseRandomLabelTaxoFacets        3.01      (8.3%)        3.09     (13.7%)    2.7% ( -17% -   26%) 0.458
                     AndHighHigh      173.99      (9.5%)      178.66     (12.1%)    2.7% ( -17% -   26%) 0.436
                   OrNotHighHigh      163.96      (5.6%)      168.45      (6.6%)    2.7% (  -8% -   15%) 0.158
                     LowSpanNear      176.24      (1.2%)      181.23      (1.6%)    2.8% (   0% -    5%) 0.000
            BrowseDateTaxoFacets        3.99     (13.8%)        4.11     (18.9%)    2.9% ( -26% -   41%) 0.577
       BrowseDayOfYearTaxoFacets        3.99     (13.0%)        4.11     (18.0%)    2.9% ( -24% -   38%) 0.554
                          IntSet      802.92      (3.9%)      827.71      (2.4%)    3.1% (  -3% -    9%) 0.003
                    OrNotHighLow     1102.01      (2.2%)     1142.50      (2.1%)    3.7% (   0% -    8%) 0.000
                          IntNRQ      653.62      (4.9%)      680.93      (1.9%)    4.2% (  -2% -   11%) 0.000
                       LowPhrase      207.68      (1.2%)      216.45      (1.7%)    4.2% (   1% -    7%) 0.000
                      OrHighHigh      192.14      (7.5%)      201.40      (8.7%)    4.8% ( -10% -   22%) 0.061
                         Prefix3      936.12      (2.3%)      987.04      (2.2%)    5.4% (   0% -   10%) 0.000
                   OrHighNotHigh      200.39      (6.5%)      212.87      (8.5%)    6.2% (  -8% -   22%) 0.009
                    OrNotHighMed      370.49      (3.1%)      398.45      (3.4%)    7.5% (   0% -   14%) 0.000
                    OrHighNotMed      308.07      (7.9%)      337.45     (10.7%)    9.5% (  -8% -   30%) 0.001
                       OrHighMed      377.59      (4.9%)      413.78      (6.0%)    9.6% (  -1% -   21%) 0.000
                       OrHighLow      345.74      (7.5%)      378.89      (9.6%)    9.6% (  -7% -   28%) 0.000
                        HighTerm      302.02     (11.7%)      339.59     (14.8%)   12.4% ( -12% -   44%) 0.003
                    OrHighNotLow      406.92      (9.0%)      461.10     (13.3%)   13.3% (  -8% -   39%) 0.000
                         MedTerm      544.38      (7.9%)      628.43     (10.2%)   15.4% (  -2% -   36%) 0.000
                         LowTerm      794.36      (6.5%)      920.28      (8.8%)   15.9% (   0% -   33%) 0.000

arity-5

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value                                                                                                                                   
     BrowseRandomLabelSSDVFacets        4.22      (9.6%)        4.04      (7.0%)   -4.3% ( -19% -   13%) 0.104                                                                                                                                                
           BrowseMonthSSDVFacets        5.74     (11.5%)        5.50     (10.2%)   -4.2% ( -23% -   19%) 0.221                                                                                
                      AndHighLow     1336.23      (3.8%)     1284.48      (2.8%)   -3.9% ( -10% -    2%) 0.000                                                                                
               HighTermTitleSort       59.92      (3.4%)       58.09      (6.3%)   -3.1% ( -12% -    6%) 0.058                                                                                
       BrowseDayOfYearSSDVFacets        5.41      (8.6%)        5.27      (8.3%)   -2.6% ( -17% -   15%) 0.321                                                                                
          OrHighMedDayTaxoFacets        2.68      (4.0%)        2.63      (6.3%)   -1.8% ( -11% -    8%) 0.270                                                                                
                    OrNotHighLow     1288.10      (2.7%)     1265.76      (2.6%)   -1.7% (  -6% -    3%) 0.038                                                                                
                      TermDTSort      121.99      (1.8%)      119.99      (3.3%)   -1.6% (  -6% -    3%) 0.048                                                                                
           BrowseMonthTaxoFacets        3.18      (2.8%)        3.14      (2.5%)   -1.5% (  -6% -    4%) 0.087                                                                                
            MedTermDayTaxoFacets       28.05      (2.2%)       27.73      (3.3%)   -1.1% (  -6% -    4%) 0.202                                                                                
                          IntNRQ      275.70      (2.3%)      272.63      (2.0%)   -1.1% (  -5% -    3%) 0.095                                                                                
               HighTermMonthSort      241.38      (5.2%)      238.72      (4.0%)   -1.1% (  -9% -    8%) 0.447                                                                                
           HighTermDayOfYearSort      135.52      (2.2%)      134.27      (2.6%)   -0.9% (  -5% -    4%) 0.236                                                                                
            HighIntervalsOrdered        6.99      (4.7%)        6.93      (5.2%)   -0.8% ( -10% -    9%) 0.609                                                                                
            HighTermTitleBDVSort       37.60      (1.7%)       37.35      (2.4%)   -0.7% (  -4% -    3%) 0.320                                                                                
         AndHighMedDayTaxoFacets       56.27      (1.2%)       56.04      (1.1%)   -0.4% (  -2% -    1%) 0.271                                                                                
                      HighPhrase       17.65      (2.3%)       17.60      (2.3%)   -0.3% (  -4% -    4%) 0.691                                                                                
                         Respell       54.37      (2.3%)       54.26      (2.1%)   -0.2% (  -4% -    4%) 0.768                                                                                
                HighSloppyPhrase       18.43      (2.1%)       18.41      (2.3%)   -0.1% (  -4% -    4%) 0.856                                                                                
                 LowSloppyPhrase       75.28      (1.5%)       75.18      (3.1%)   -0.1% (  -4% -    4%) 0.872                                                                                
        AndHighHighDayTaxoFacets       53.16      (0.9%)       53.10      (0.8%)   -0.1% (  -1% -    1%) 0.677                                                                                
                        PKLookup      243.00      (2.2%)      243.25      (2.2%)    0.1% (  -4% -    4%) 0.886                 
                       LowPhrase       24.08      (1.9%)       24.11      (2.0%)    0.1% (  -3% -    4%) 0.854                 
                 MedSloppyPhrase       27.86      (1.7%)       27.90      (1.9%)    0.1% (  -3% -    3%) 0.818                 
                        Wildcard      383.59      (4.5%)      384.41      (3.3%)    0.2% (  -7% -    8%) 0.863                 
                    HighSpanNear       34.11      (2.5%)       34.20      (2.7%)    0.3% (  -4% -    5%) 0.754                 
                           range     2658.46      (5.9%)     2665.62      (4.1%)    0.3% (  -9% -   10%) 0.867                 
                          Fuzzy1      100.42      (3.9%)      100.77      (2.9%)    0.3% (  -6% -    7%) 0.752                 
             MedIntervalsOrdered       59.23      (1.5%)       59.68      (1.6%)    0.8% (  -2% -    3%) 0.123                 
                          Fuzzy2       80.09      (2.9%)       80.83      (3.3%)    0.9% (  -5% -    7%) 0.349                 
     BrowseRandomLabelTaxoFacets        2.84      (5.7%)        2.88      (7.5%)    1.5% ( -11% -   15%) 0.488                 
                       MedPhrase      130.23      (1.1%)      132.72      (2.9%)    1.9% (  -2% -    6%) 0.006                 
                          IntSet      723.72      (3.3%)      737.90      (3.4%)    2.0% (  -4% -    9%) 0.067                 
                         Prefix3      608.92      (4.4%)      621.60      (2.4%)    2.1% (  -4% -    9%) 0.062                 
                     MedSpanNear      115.65      (3.1%)      118.46      (2.9%)    2.4% (  -3% -    8%) 0.010                 
            BrowseDateSSDVFacets        1.02      (9.6%)        1.04     (10.1%)    2.5% ( -15% -   24%) 0.418                 
             LowIntervalsOrdered      273.75      (5.4%)      281.51      (6.1%)    2.8% (  -8% -   15%) 0.120                 
                     LowSpanNear      322.13      (1.5%)      331.48      (1.7%)    2.9% (   0% -    6%) 0.000                 
                      AndHighMed      497.46      (1.7%)      516.31      (2.7%)    3.8% (   0% -    8%) 0.000                 
                   OrNotHighHigh      121.00      (7.7%)      125.67      (7.7%)    3.9% ( -10% -   20%) 0.115                 
       BrowseDayOfYearTaxoFacets        3.87      (9.0%)        4.07     (15.1%)    5.0% ( -17% -   32%) 0.203                 
                   OrHighNotHigh      195.50      (7.4%)      205.34      (8.1%)    5.0% (  -9% -   22%) 0.039                 
            BrowseDateTaxoFacets        3.87      (9.2%)        4.06     (15.9%)    5.1% ( -18% -   33%) 0.209                 
                    OrNotHighMed      313.91      (5.4%)      332.61      (5.9%)    6.0% (  -5% -   18%) 0.001                 
                     AndHighHigh      204.74      (8.8%)      217.01      (8.1%)    6.0% ( -10% -   25%) 0.025                 
                      OrHighHigh      190.70      (8.5%)      202.31      (8.2%)    6.1% (  -9% -   24%) 0.021                 
                    OrHighNotMed      296.82      (9.6%)      320.08     (10.2%)    7.8% ( -10% -   30%) 0.012                 
                    OrHighNotLow      349.04     (11.9%)      378.12     (12.9%)    8.3% ( -14% -   37%) 0.034                 
                       OrHighMed      368.13      (4.7%)      399.89      (3.4%)    8.6% (   0% -   17%) 0.000                 
                        HighTerm      381.10     (11.0%)      418.78     (11.7%)    9.9% ( -11% -   36%) 0.006                 
                       OrHighLow      368.70      (7.5%)      406.87      (7.5%)   10.4% (  -4% -   27%) 0.000                 
                         MedTerm      531.50      (7.8%)      590.03      (8.4%)   11.0% (  -4% -   29%) 0.000                 
                         LowTerm      760.84      (6.5%)      849.10      (7.6%)   11.6% (  -2% -   27%) 0.000          

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, these benchmark results are quite convincing. I'm slightly uneasy about introducing loops that are unlikely to be unrolled, I could see it cause performance degradations in cases that we are not benchmarking here. Maybe keep LongHeap binary for now and introduce a TernaryLongHeap class? We can share code via static void upHeap(long[] heap, int i, int arity) helpers, and passing constants as the arity should help the compiler unroll the loops when it gets inlined? Let's only move top-hits collection to TernaryLongHeap for now and look into whether it also makes sense for vector search in a follow-up? What do you think?

@RamakrishnaChilaka
Copy link
Contributor Author

Thanks @jpountz for reviewing this PR.

I agree that it makes sense to keep LongHeap binary for now, given the scope of our current benchmarks. As you suggested, I’ll refactor the shared logic into static helpers upHeap/downHeap that take arity as a constant, introduce a TernaryLongHeap class with arity=3 hardcoded, and switch only top-hits collectors to use it in this PR.

We can then revisit vector search in a follow-up once we have benchmarks for that workload to validate whether it benefits from the same change.

@RamakrishnaChilaka
Copy link
Contributor Author

RamakrishnaChilaka commented Sep 2, 2025

I have implemented the following changes:

  • Refactored LongHeap to include static helper methods upHeap() and downHeap() that accept arity as a parameter
  • Added a new TernaryLongHeap class with arity = 3.
  • Updated TopScoreDocCollector to use TernaryLongHeap instead of LongHeap.
  • Left LongHeap as binary-arity (arity = 2) unchanged, i.e. its upHeap/downHeap remain separate to avoid any regressions.

I re-ran benchmarks on c8g.8xlarge (graviton) instance. Please re-review @jpountz..

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
           BrowseMonthTaxoFacets        3.21      (6.7%)        3.14      (2.0%)   -2.3% ( -10% -    6%) 0.133
            BrowseDateTaxoFacets        3.94     (11.0%)        3.88      (8.0%)   -1.6% ( -18% -   19%) 0.587
       BrowseDayOfYearTaxoFacets        3.95     (10.6%)        3.88      (7.7%)   -1.6% ( -17% -   18%) 0.581
                      AndHighLow     1644.06      (3.0%)     1618.80      (1.9%)   -1.5% (  -6% -    3%) 0.053
           HighTermDayOfYearSort      113.88      (3.4%)      112.21      (2.8%)   -1.5% (  -7% -    4%) 0.137
            BrowseDateSSDVFacets        1.06      (9.3%)        1.05      (9.7%)   -1.1% ( -18% -   19%) 0.719
     BrowseRandomLabelTaxoFacets        2.95      (7.9%)        2.92      (5.7%)   -1.0% ( -13% -   13%) 0.633
                      TermDTSort      140.32      (3.1%)      138.94      (3.6%)   -1.0% (  -7% -    5%) 0.357
            HighTermTitleBDVSort       34.29      (2.3%)       33.96      (2.5%)   -0.9% (  -5% -    3%) 0.212
                           range     4030.14      (4.9%)     4004.47      (3.4%)   -0.6% (  -8% -    8%) 0.633
            MedTermDayTaxoFacets       58.42      (1.6%)       58.08      (2.1%)   -0.6% (  -4% -    3%) 0.312
         AndHighMedDayTaxoFacets       62.61      (0.9%)       62.30      (1.0%)   -0.5% (  -2% -    1%) 0.101
               HighTermTitleSort       86.93      (2.0%)       86.73      (2.7%)   -0.2% (  -4% -    4%) 0.758
                HighSloppyPhrase       32.36      (3.1%)       32.34      (3.1%)   -0.1% (  -6% -    6%) 0.932
     BrowseRandomLabelSSDVFacets        4.08     (10.8%)        4.08     (11.0%)    0.0% ( -19% -   24%) 0.999
       BrowseDayOfYearSSDVFacets        5.26      (7.0%)        5.27     (12.0%)    0.2% ( -17% -   20%) 0.954
        AndHighHighDayTaxoFacets       26.54      (0.9%)       26.59      (1.2%)    0.2% (  -1% -    2%) 0.571
                        PKLookup      245.99      (1.2%)      246.64      (2.4%)    0.3% (  -3% -    3%) 0.657
                 MedSloppyPhrase       76.81      (3.0%)       77.12      (3.6%)    0.4% (  -6% -    7%) 0.695
          OrHighMedDayTaxoFacets       12.97      (4.0%)       13.02      (4.5%)    0.5% (  -7% -    9%) 0.739
                         Respell       38.33      (2.0%)       38.55      (1.9%)    0.6% (  -3% -    4%) 0.329
            HighIntervalsOrdered       10.47      (9.0%)       10.53      (9.7%)    0.6% ( -16% -   21%) 0.838
                    HighSpanNear        5.59      (3.6%)        5.63      (3.2%)    0.8% (  -5% -    7%) 0.468
               HighTermMonthSort      252.82      (3.9%)      254.86      (5.5%)    0.8% (  -8% -   10%) 0.592
                       LowPhrase       77.26      (1.8%)       78.11      (1.3%)    1.1% (  -2% -    4%) 0.028
                 LowSloppyPhrase      131.76      (2.5%)      133.56      (2.3%)    1.4% (  -3% -    6%) 0.075
             MedIntervalsOrdered       53.50      (4.6%)       54.25      (4.9%)    1.4% (  -7% -   11%) 0.349
                          Fuzzy1       93.04      (1.1%)       94.40      (1.4%)    1.5% (  -1% -    4%) 0.000
           BrowseMonthSSDVFacets        5.53     (13.0%)        5.62     (15.0%)    1.5% ( -23% -   33%) 0.736
                          Fuzzy2       79.01      (1.3%)       80.34      (1.4%)    1.7% (   0% -    4%) 0.000
                      HighPhrase       52.31      (1.7%)       53.19      (1.5%)    1.7% (  -1% -    4%) 0.001
                   OrNotHighHigh      178.27      (6.7%)      181.77      (6.4%)    2.0% ( -10% -   16%) 0.344
                       MedPhrase       93.34      (1.7%)       95.35      (1.0%)    2.2% (   0% -    4%) 0.000
                   OrHighNotHigh      161.33      (7.8%)      165.05      (7.7%)    2.3% ( -12% -   19%) 0.345
             LowIntervalsOrdered      113.89      (6.3%)      116.73      (7.0%)    2.5% ( -10% -   16%) 0.234
                         Prefix3      446.66      (1.1%)      460.53      (2.2%)    3.1% (   0% -    6%) 0.000
                          IntSet      797.35      (3.6%)      829.10      (5.9%)    4.0% (  -5% -   14%) 0.010
                     LowSpanNear      292.44      (3.4%)      304.43      (2.7%)    4.1% (  -1% -   10%) 0.000
                     AndHighHigh      171.85     (12.6%)      179.11     (12.5%)    4.2% ( -18% -   33%) 0.288
                          IntNRQ      540.65      (3.0%)      564.98      (1.8%)    4.5% (   0% -    9%) 0.000
                      OrHighHigh      145.55     (10.5%)      152.50     (12.0%)    4.8% ( -16% -   30%) 0.180
                        Wildcard      691.41      (2.7%)      728.49      (2.9%)    5.4% (   0% -   11%) 0.000
                    OrNotHighLow     1070.20      (1.7%)     1127.88      (2.8%)    5.4% (   0% -   10%) 0.000
                     MedSpanNear      223.45      (2.3%)      235.74      (1.8%)    5.5% (   1% -    9%) 0.000
                      AndHighMed      460.42      (4.5%)      486.06      (4.6%)    5.6% (  -3% -   15%) 0.000
                    OrNotHighMed      381.97      (3.9%)      404.81      (4.5%)    6.0% (  -2% -   14%) 0.000
                       OrHighLow      275.73     (10.0%)      298.67     (11.7%)    8.3% ( -12% -   33%) 0.015
                        HighTerm      270.46     (13.9%)      294.96     (16.8%)    9.1% ( -18% -   46%) 0.063
                    OrHighNotMed      387.26      (6.6%)      425.74      (8.6%)    9.9% (  -4% -   26%) 0.000
                    OrHighNotLow      367.92     (11.3%)      406.06     (15.2%)   10.4% ( -14% -   41%) 0.014
                       OrHighMed      384.93      (4.2%)      427.50      (5.5%)   11.1% (   1% -   21%) 0.000
                         MedTerm      533.01      (7.4%)      611.25      (9.9%)   14.7% (  -2% -   34%) 0.000
                         LowTerm      779.05      (7.2%)      917.16      (9.3%)   17.7% (   1% -   36%) 0.000

Copy link
Contributor

@jpountz jpountz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left minor comments but the change looks good to me overall!

@github-actions github-actions bot modified the milestones: 10.3.0, 10.4.0 Sep 2, 2025
@RamakrishnaChilaka
Copy link
Contributor Author

Thanks for reviewing again @jpountz.

I've addressed all the minor comments. Please re-review the PR.

@jpountz jpountz merged commit ac90517 into apache:main Sep 2, 2025
8 checks passed
@RamakrishnaChilaka RamakrishnaChilaka deleted the feature_n_ary_long_heap branch September 2, 2025 14:10
@RamakrishnaChilaka
Copy link
Contributor Author

@jpountz
Copy link
Contributor

jpountz commented Sep 3, 2025

This is great! Would you like to open a PR against luceneutil to add an annotation?

I'm looking forward to seeing whether this can help with vector search as well. cc @benwtrent @msokolov

@msokolov
Copy link
Contributor

msokolov commented Sep 3, 2025

Did we do any testing with smaller topN (say 20 or 100)? I suspect we wouldn't see any improvement there, and might even see some loss. If that's true, we might want to gate this optimization on the value of N.

@msokolov
Copy link
Contributor

msokolov commented Sep 3, 2025

But I don't want to be negative Nelly here, this is a cool idea, and I love that it helps! I do suspect though that it won't help much with KNN search since the typical values for K are smaller

@benwtrent
Copy link
Member

With oversampling (3x - 5x) and quantized scoring (so the dominating cost of floating point ops goes away), I have seen other administrivia of HNSW searching be more and more the cause of latency.

It would be interesting to see the latency for k==100 & oversampling=3x with binary quantization.

Like @msokolov I wouldn't expect anything on regular float32 (though, you never know until you benchmark it!)

@RamakrishnaChilaka
Copy link
Contributor Author

Did we do any testing with smaller topN (say 20 or 100)? I suspect we wouldn't see any improvement there, and might even see some loss. If that's true, we might want to gate this optimization on the value of N.

The nightly benchmark runs with topN as 100, we do see improvement in perf (see ref).

I will run the benchmark with topN as 20, to check, if we observe regression.

@RamakrishnaChilaka
Copy link
Contributor Author

I ran benchmarks with arity=3 and topN=20 on wikibigall on i3.8xlarge

The results show no statistically significant regressions with topN as 20.

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                    OrHighNotMed      560.65     (12.3%)      532.49     (10.4%)   -5.0% ( -24% -   20%) 0.164
           HighTermDayOfYearSort      389.71      (6.1%)      379.50      (4.3%)   -2.6% ( -12% -    8%) 0.118
                 LowSloppyPhrase       31.28      (9.3%)       30.50      (8.8%)   -2.5% ( -18% -   17%) 0.380
        AndHighHighDayTaxoFacets       12.43      (5.0%)       12.20      (4.6%)   -1.8% ( -10% -    8%) 0.225
       BrowseDayOfYearSSDVFacets        2.53     (14.2%)        2.49     (12.0%)   -1.7% ( -24% -   28%) 0.681
            MedTermDayTaxoFacets       16.95      (5.8%)       16.67      (7.4%)   -1.6% ( -13% -   12%) 0.436
                          Fuzzy2       40.90      (8.5%)       40.26     (10.0%)   -1.6% ( -18% -   18%) 0.595
                     MedSpanNear      123.79     (12.1%)      122.08     (13.0%)   -1.4% ( -23% -   26%) 0.727
                   OrHighNotHigh      615.22      (7.2%)      607.15      (6.4%)   -1.3% ( -13% -   13%) 0.540
                      AndHighLow      842.03      (3.1%)      831.74      (3.2%)   -1.2% (  -7% -    5%) 0.220
                         Prefix3      877.74      (2.9%)      867.66      (3.4%)   -1.1% (  -7% -    5%) 0.246
                      HighPhrase       59.19      (4.5%)       58.62      (4.1%)   -1.0% (  -9% -    8%) 0.476
                     LowSpanNear      153.60      (6.1%)      152.29      (6.6%)   -0.9% ( -12% -   12%) 0.671
                       OrHighLow      670.48      (5.0%)      664.93      (4.5%)   -0.8% (  -9% -    9%) 0.583
               HighTermMonthSort     1357.59      (3.2%)     1350.69      (5.6%)   -0.5% (  -9% -    8%) 0.726
           BrowseMonthTaxoFacets        2.02      (7.5%)        2.02      (8.4%)   -0.1% ( -14% -   17%) 0.964
            HighIntervalsOrdered       20.84      (8.3%)       20.83      (8.6%)   -0.1% ( -15% -   18%) 0.978
                          IntNRQ      147.02      (1.6%)      146.94      (1.3%)   -0.1% (  -2% -    2%) 0.912
                        Wildcard      173.40      (2.9%)      173.51      (2.6%)    0.1% (  -5% -    5%) 0.942
     BrowseRandomLabelTaxoFacets        1.40      (3.5%)        1.40      (3.3%)    0.3% (  -6% -    7%) 0.803
                      AndHighMed      310.68      (8.0%)      311.55      (8.2%)    0.3% ( -14% -   17%) 0.912
         AndHighMedDayTaxoFacets       24.35      (4.0%)       24.44      (3.2%)    0.4% (  -6% -    7%) 0.737
                 MedSloppyPhrase       26.19      (2.7%)       26.31      (3.7%)    0.4% (  -5% -    7%) 0.668
                    HighSpanNear        8.56      (4.7%)        8.61      (4.9%)    0.5% (  -8% -   10%) 0.737
                     AndHighHigh      141.75     (19.2%)      142.51     (17.5%)    0.5% ( -30% -   46%) 0.927
                       LowPhrase      204.22      (3.4%)      205.45      (3.5%)    0.6% (  -6% -    7%) 0.583
                    OrNotHighMed      591.68      (5.7%)      595.28      (6.7%)    0.6% ( -11% -   13%) 0.758
                      TermDTSort      219.14      (3.9%)      220.82      (5.6%)    0.8% (  -8% -   10%) 0.615
                HighSloppyPhrase       21.66      (4.6%)       21.85      (7.2%)    0.9% ( -10% -   13%) 0.638
                    OrNotHighLow      838.61      (4.7%)      847.01      (4.8%)    1.0% (  -8% -   10%) 0.503
                         Respell       20.48      (6.6%)       20.69      (5.5%)    1.1% ( -10% -   14%) 0.583
                          Fuzzy1       45.98      (8.0%)       46.50      (8.0%)    1.1% ( -13% -   18%) 0.653
                      OrHighHigh      109.85     (20.7%)      111.12     (20.8%)    1.2% ( -33% -   53%) 0.860
     BrowseRandomLabelSSDVFacets        1.59      (7.1%)        1.61     (10.4%)    1.3% ( -15% -   20%) 0.653
                       MedPhrase      421.59      (3.2%)      427.00      (3.2%)    1.3% (  -4% -    7%) 0.204
                       OrHighMed      316.82     (13.9%)      321.65     (13.6%)    1.5% ( -22% -   33%) 0.726
                        HighTerm      411.86     (21.1%)      418.48     (20.1%)    1.6% ( -32% -   54%) 0.805
            HighTermTitleBDVSort       13.60      (5.3%)       13.84      (5.7%)    1.8% (  -8% -   13%) 0.312
            BrowseDateTaxoFacets        1.82      (6.3%)        1.85      (7.3%)    1.8% ( -11% -   16%) 0.408
               HighTermTitleSort      102.22      (4.6%)      104.06      (4.9%)    1.8% (  -7% -   11%) 0.232
       BrowseDayOfYearTaxoFacets        1.87      (6.8%)        1.90      (8.3%)    1.8% ( -12% -   18%) 0.446
                   OrNotHighHigh      544.66     (10.8%)      554.63     (12.4%)    1.8% ( -19% -   28%) 0.619
          OrHighMedDayTaxoFacets        5.43      (7.4%)        5.53      (7.2%)    1.9% ( -11% -   17%) 0.417
                           range     3046.35      (8.8%)     3106.25      (8.5%)    2.0% ( -14% -   21%) 0.472
                         LowTerm      866.65     (31.5%)      884.09     (30.8%)    2.0% ( -45% -   94%) 0.838
                        PKLookup      133.59      (8.8%)      137.11      (8.0%)    2.6% ( -13% -   21%) 0.321
                    OrHighNotLow      459.18     (11.2%)      472.18      (9.2%)    2.8% ( -15% -   26%) 0.382
             MedIntervalsOrdered       77.62      (9.3%)       80.07      (8.9%)    3.2% ( -13% -   23%) 0.274
            BrowseDateSSDVFacets        0.54     (11.9%)        0.56     (10.9%)    3.5% ( -17% -   29%) 0.337
             LowIntervalsOrdered       20.99      (6.9%)       21.72      (7.2%)    3.5% (  -9% -   18%) 0.117
                         MedTerm      394.43     (11.2%)      409.52     (14.7%)    3.8% ( -19% -   33%) 0.356
                          IntSet      373.81      (8.4%)      388.84     (10.3%)    4.0% ( -13% -   24%) 0.177
           BrowseMonthSSDVFacets        2.68     (13.7%)        2.84     (19.3%)    5.8% ( -23% -   45%) 0.272

@jpountz
Copy link
Contributor

jpountz commented Sep 3, 2025

I do suspect though that it won't help much with KNN search since the typical values for K are smaller

Are they? I would expect some users to do vector search with k=1000 and then re-rank them.

@RamakrishnaChilaka
Copy link
Contributor Author

I'm looking forward to seeing whether this can help with vector search as well. cc @benwtrent @msokolov

For this benchmark, I switched FloatHeap and BlockingFloatHeap from binary to ternary heaps, and used TernaryLongHeap in NeighborQueue. Luceneutil has been run with TopN as 1000 (see mikemccand/luceneutil#357). I believe most of the speedup comes from the heap exchange in MultiLeafKnnCollector.

Please find the results below (source: enwiki-20120502-mpnet (default in vector-test), Ran benchmarks on c8g.8xlarge (graviton) instance.)

                            TaskQPS baseline      StdDevQPS candidate      StdDev                Pct diff p-value
                        PKLookup      469.82      (0.8%)      473.96      (1.0%)    0.9% (   0% -    2%) 0.002
                AndHighMedVector      122.09      (1.8%)      124.39      (1.4%)    1.9% (  -1% -    5%) 0.000
                AndHighLowVector      139.25      (2.0%)      142.01      (1.5%)    2.0% (  -1% -    5%) 0.000
               AndHighHighVector      122.54      (1.8%)      124.97      (1.4%)    2.0% (  -1% -    5%) 0.000
                  HighTermVector      131.17      (1.8%)      133.95      (1.4%)    2.1% (  -1% -    5%) 0.000
                   MedTermVector      147.68      (1.9%)      150.89      (1.4%)    2.2% (  -1% -    5%) 0.000
                   LowTermVector      144.38      (2.0%)      147.60      (1.4%)    2.2% (  -1% -    5%) 0.000

@msokolov
Copy link
Contributor

msokolov commented Sep 4, 2025

thanks for checking w/smaller K/N - glad there was no regression there

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants