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

Shave allocation overheads in recent iOS texture loading code #6471

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

frenzibyte
Copy link
Member

Noticed while attempting to migrate this to macOS, the Crop part had allocation overhead with it (which...makes sense). Naive coding from my part.

In case it's not clear already, it's not possible to directly load the image off of the vImage pixel buffer as each row in the buffer has additional space at the end for performance reasons (memory alignment etc.). I've replaced the load-and-crop step with loading an empty image and copying row by row directly to memory.

Time measuring of the texture loading process shows nothing bad, maybe good even (left master, right this PR):

CleanShot 2024-12-23 at 10 11 39

@peppy
Copy link
Member

peppy commented Dec 23, 2024

was going to mention this. good job finding and fixing yourself.

@peppy peppy merged commit c4073f9 into ppy:master Dec 23, 2024
12 of 14 checks passed
@frenzibyte frenzibyte deleted the ios-avoid-crop branch December 23, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants