Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make slider path parsing more friendly with spans #27418

Merged
merged 12 commits into from
Mar 22, 2024

Conversation

huoyaoyuan
Copy link
Contributor

@huoyaoyuan huoyaoyuan commented Feb 28, 2024

In order to unblock #23282, this PR refactors slider parsing to not passing substrings around.

The majority of existing logic is preserved. The performance shouldn't change much with this PR, just ensuring there's no regression.

Before:

Method Mean Error StdDev Gen0 Gen1 Allocated
BenchmarkBundledBeatmap 1.529 ms 0.0083 ms 0.0065 ms 228.5156 187.5000 4.13 MB

After:

Method Mean Error StdDev Gen0 Gen1 Allocated
BenchmarkBundledBeatmap 1.540 ms 0.0208 ms 0.0195 ms 228.5156 187.5000 4.12 MB

Copy link
Member

@frenzibyte frenzibyte left a comment

Choose a reason for hiding this comment

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

Looks good to both my eyes and CI.

{
int startIndex = segmentsBuffer[i].StartIndex;
int endIndex = segmentsBuffer[i + 1].StartIndex;
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints.Slice(startIndex, endIndex - startIndex), pointsBuffer[endIndex]));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Specifically, I think this particular case is better readable with range expression.

I don't have preference on other cases though.

Copy link
Member

Choose a reason for hiding this comment

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

There have been multiple occurrences of the .. operator being used and us not liking it in review, I don't want that happening here so I changed it with the Slice method to move the PR forward.

@frenzibyte frenzibyte requested a review from a team March 19, 2024 02:29
@frenzibyte
Copy link
Member

Requesting a second pair of eyes before proceeding with a merge, the PR is good but I'm not sure if there's something I should've checked against before approval (like triggering a diffcalc command to make sure nothing has changed with beatmap parsing or something).

@smoogipoo
Copy link
Contributor

!diffcalc

Copy link

github-actions bot commented Mar 19, 2024

@frenzibyte
Copy link
Member

Spreadsheets show no difference as well, so let's get this in.

@frenzibyte frenzibyte merged commit b9b9ef6 into ppy:master Mar 22, 2024
9 of 11 checks passed
@huoyaoyuan huoyaoyuan deleted the convert-path-string-new branch March 22, 2024 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants