Quaver.API icon indicating copy to clipboard operation
Quaver.API copied to clipboard

Optimise bin selection in difficulty calculation

Open WilliamQiufeng opened this issue 1 year ago • 0 comments

Importing Force! Full Album now takes 10s than 2 minutes.

...
            var valuesInBin = StrainSolverData.Where(s => s.StartTime >= i && s.StartTime < i + binSize).ToList();
...

This line is very inefficient.
My PR optimises it so that CalculateOverallDifficulty() is now $O(n)$ instead of $O(n^2)$, where n is StrainSolverData.Count.

The following patch lets you better check if there's any bug with this change.

Debug_Diffcalc_bin_optimization.patch

WilliamQiufeng avatar Aug 17 '24 14:08 WilliamQiufeng