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

Eliminate bounds checks in read_coefficients() (for zero performance gain?) #121

Merged
merged 8 commits into from
Nov 6, 2024

Conversation

Shnatsel
Copy link
Contributor

This PR removes all bounds checks from the hot loop of read_coefficients(). Workshopped by staring at the assembly using cargo-show-asm on baseline x86_64.

This function's execution (excluding other functions it calls) accounts for 20% of the time on the profile from #71. Despite that, I could not measure any difference in end-to-end performance on my machine. So feel free to reject this PR.

Copy link
Member

@HeroicKatora HeroicKatora left a comment

Choose a reason for hiding this comment

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

I find the code slightly more readable in any case, with comments and probs iteration in particular.

src/vp8.rs Outdated Show resolved Hide resolved
src/vp8.rs Outdated Show resolved Hide resolved
src/vp8.rs Show resolved Hide resolved
@Shnatsel
Copy link
Contributor Author

I've removed the % hack that increased complexity, so now this also works as a refactoring.

@HeroicKatora HeroicKatora merged commit ecead22 into image-rs:main Nov 6, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants