Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Optimise bin selection in difficulty calculation #179

Merged
merged 6 commits into from
Aug 19, 2024

Conversation

WilliamQiufeng
Copy link
Member

@WilliamQiufeng WilliamQiufeng commented Aug 17, 2024

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

I wrote a verification tool:
https://github.com/WilliamQiufeng/Quaver.VerifyOptimizedBinDiffCalc

git clone --recurse-submodules https://github.com/WilliamQiufeng/Quaver.VerifyOptimizedBinDiffCalc
cd Quaver.VerifyOptimizedBinDiffCalc
dotnet run --project RecalcTest <path-to-song-dir>

The optimization will for now only apply to 4K maps due to a bug described in #181

@AiAe AiAe marked this pull request as draft August 18, 2024 13:16

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@WilliamQiufeng WilliamQiufeng marked this pull request as ready for review August 18, 2024 15:50
l -> leftIndex
r -> rightIndex
useFallback is only enabled on odd key count (not counting scratch)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@Warp9000 Warp9000 merged commit 05ab6e2 into Quaver:master Aug 19, 2024
1 of 2 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants