lucene icon indicating copy to clipboard operation
lucene copied to clipboard

Optimize slice calculation in IndexSearcher a little

Open original-brownbear opened this issue 4 months ago • 0 comments

Fewer volatile reads, less indirection and a fast-path for when there's no executor. Also, saving some copies, sorting array instead of list, and saving allocations all around. This PR is obviously not a big win but in aggregate it's quite measurable and mostly deals with tiny regressions introduced recently. So opening this as a suggestion for dealing with that boiling frog :)

Luceneutil over 40 rounds does show small but significant improvements:

                            TaskQPS baseline      StdDevQPS my_modified_version      StdDev                Pct diff p-value
                      AndHighLow     1495.00      (5.8%)     1481.40      (5.5%)   -0.9% ( -11% -   11%) 0.471
                    OrNotHighLow     1303.33      (5.9%)     1303.23      (7.1%)   -0.0% ( -12% -   13%) 0.996
           BrowseMonthTaxoFacets       12.49     (25.8%)       12.53     (30.2%)    0.3% ( -44% -   76%) 0.959
                      AndHighMed      331.01      (6.7%)      333.83      (5.6%)    0.9% ( -10% -   14%) 0.537
               HighTermTitleSort       61.03      (3.6%)       61.57      (3.5%)    0.9% (  -5% -    8%) 0.261
                         LowTerm      670.36      (3.9%)      677.32      (4.2%)    1.0% (  -6% -    9%) 0.253
                          Fuzzy1       90.76      (3.3%)       91.82      (3.9%)    1.2% (  -5% -    8%) 0.149
           BrowseMonthSSDVFacets        4.57     (12.5%)        4.63      (7.2%)    1.3% ( -16% -   24%) 0.563
                         MedTerm      481.17      (8.8%)      487.77      (6.1%)    1.4% ( -12% -   17%) 0.416
                       OrHighLow      779.19      (4.3%)      790.11      (4.0%)    1.4% (  -6% -   10%) 0.132
                         Prefix3      410.59      (6.4%)      417.03      (7.0%)    1.6% ( -11% -   15%) 0.296
                       OrHighMed      211.85      (5.2%)      215.23      (6.0%)    1.6% (  -9% -   13%) 0.201
                    OrNotHighMed      376.36      (4.2%)      382.45      (4.3%)    1.6% (  -6% -   10%) 0.089
                   OrHighNotHigh      266.72      (5.5%)      271.13      (5.1%)    1.7% (  -8% -   12%) 0.161
                    HighSpanNear       18.28      (7.7%)       18.59      (8.0%)    1.7% ( -13% -   18%) 0.332
         AndHighMedDayTaxoFacets       47.77      (4.3%)       48.60      (3.3%)    1.7% (  -5% -    9%) 0.042
                          Fuzzy2       72.70      (2.8%)       74.05      (2.9%)    1.9% (  -3% -    7%) 0.004
            HighTermTitleBDVSort       22.00      (7.1%)       22.41      (6.7%)    1.9% ( -11% -   16%) 0.228
                        PKLookup      240.31      (2.0%)      244.88      (2.2%)    1.9% (  -2% -    6%) 0.000
                     AndHighHigh       99.80      (4.0%)      101.75      (2.7%)    2.0% (  -4% -    8%) 0.010
                          IntNRQ       94.21      (5.0%)       96.05      (4.8%)    2.0% (  -7% -   12%) 0.075
                 MedSloppyPhrase       61.87      (3.5%)       63.11      (4.0%)    2.0% (  -5% -    9%) 0.017
                    OrHighNotLow      522.07      (8.3%)      533.24      (8.1%)    2.1% ( -13% -   20%) 0.243
                       LowPhrase       51.26      (3.7%)       52.36      (3.7%)    2.1% (  -5% -    9%) 0.009
                      OrHighHigh       53.23      (8.3%)       54.52      (8.1%)    2.4% ( -12% -   20%) 0.189
            MedTermDayTaxoFacets       13.21      (4.6%)       13.54      (4.9%)    2.5% (  -6% -   12%) 0.020
             MedIntervalsOrdered       48.53      (5.4%)       49.82      (6.3%)    2.7% (  -8% -   15%) 0.042
                HighSloppyPhrase       23.58      (6.1%)       24.22      (7.6%)    2.7% ( -10% -   17%) 0.081
                    OrHighNotMed      422.74      (4.9%)      434.52      (5.2%)    2.8% (  -6% -   13%) 0.014
     BrowseRandomLabelTaxoFacets        4.46      (9.2%)        4.59      (9.0%)    2.8% ( -14% -   23%) 0.168
           HighTermDayOfYearSort      403.10      (7.0%)      414.37      (6.8%)    2.8% ( -10% -   17%) 0.071
       BrowseDayOfYearSSDVFacets        4.55      (8.2%)        4.68      (7.2%)    2.8% ( -11% -   19%) 0.104
                       MedPhrase      382.95      (9.3%)      393.79      (9.2%)    2.8% ( -14% -   23%) 0.172
                         Respell       49.12      (1.2%)       50.54      (2.2%)    2.9% (   0% -    6%) 0.000
               HighTermMonthSort     1514.02      (6.1%)     1557.67      (6.3%)    2.9% (  -8% -   16%) 0.038
                     MedSpanNear       41.96      (5.2%)       43.21      (5.6%)    3.0% (  -7% -   14%) 0.013
                        HighTerm      591.81      (7.2%)      609.51      (6.6%)    3.0% ( -10% -   18%) 0.053
                      HighPhrase       82.89      (6.9%)       85.37      (6.0%)    3.0% (  -9% -   16%) 0.038
                        Wildcard      160.07      (3.4%)      165.02      (3.5%)    3.1% (  -3% -   10%) 0.000
                   OrNotHighHigh      500.91      (7.0%)      516.89      (7.2%)    3.2% ( -10% -   18%) 0.045
     BrowseRandomLabelSSDVFacets        3.31      (3.6%)        3.41      (5.6%)    3.3% (  -5% -   12%) 0.002
             LowIntervalsOrdered        8.36      (8.6%)        8.65      (7.6%)    3.5% ( -11% -   21%) 0.056
                     LowSpanNear       37.83      (2.5%)       39.17      (2.6%)    3.5% (  -1% -    8%) 0.000
        AndHighHighDayTaxoFacets       13.87      (4.8%)       14.39      (6.0%)    3.7% (  -6% -   15%) 0.002
                 LowSloppyPhrase       19.46      (3.5%)       20.20      (5.3%)    3.8% (  -4% -   13%) 0.000
                      TermDTSort      173.31      (6.5%)      180.12      (6.5%)    3.9% (  -8% -   18%) 0.007
            HighIntervalsOrdered       19.36      (6.3%)       20.13      (6.0%)    4.0% (  -7% -   17%) 0.004
       BrowseDayOfYearTaxoFacets        5.46     (11.7%)        5.70     (10.9%)    4.4% ( -16% -   30%) 0.080
            BrowseDateSSDVFacets        1.23      (7.5%)        1.29      (7.1%)    4.7% (  -9% -   20%) 0.004
            BrowseDateTaxoFacets        5.36     (11.4%)        5.62     (11.1%)    4.7% ( -16% -   30%) 0.061
          OrHighMedDayTaxoFacets        4.77      (8.8%)        5.02      (8.9%)    5.2% ( -11% -   25%) 0.008

original-brownbear avatar Oct 04 '24 21:10 original-brownbear