Improve the performance of score calculation, especially for the 'window' profile.
Scoring runs a regression for each of 2500 bootstrap resamples per test, and each
resample was sorted twice.
- In _windowedFit(), keep running sums over the window rather than recomputing the
averages for every sample, and stop the scan for bestIndex early.
- Since bootstrap resamples arrive already sorted by complexity, _windowedFit() now
only sorts runs of equal complexity by time, falling back to a full sort otherwise.
- Sort each bootstrap resample with a stable counting sort on precomputed complexity
ranks, instead of a comparison sort.
Results are unchanged. Scoring the unit test data with the window profile goes from
about 1060ms to 640ms; slope and flat get about 25% faster.
2 files changed