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

Fix performance regression introduced by syncable_voice #11

Merged
merged 1 commit into from
Aug 7, 2022

Conversation

lukaslihotzki
Copy link
Contributor

Every call to syncable_voice and syncable_voice_mut uses a predictable index, so these calls can be optimized well, in theory. However, rustc doesn't optimize rotate_left calls. Therefore, use a handwritten rotate3 function (for arrays of size 3) instead.

This change does speed up the complete SID emulation (Synth::clock and Synth::output, without resampling) by 45%. @binaryfields, it would be nice if you could verify this.

Copy link
Owner

@binaryfields binaryfields left a comment

Choose a reason for hiding this comment

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

looks great!

@binaryfields binaryfields merged commit 649389a into binaryfields:master Aug 7, 2022
@binaryfields
Copy link
Owner

Great catch! I added a new benchmark to capture perf of SID synth clocking and got the same result as you, a 41.48% speedup. This is a massive speedup,

I truly don't understand why std implementation would be so bad in the case of small arrays but I'll take a handcrafted version with these types of results any day. :)

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.

2 participants