Skip to content

Optimize matrix scanning by removing variable shifts #14947

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

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

chadaustin
Copy link

Description

AVR does not include a barrel shifter. Variable shifts compile into
loops that carry the bits across multiple 8-bit registers.

This small optimization increases the matrix scan rate on my keyboard
from 598 to 628.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

AVR does not include a barrel shifter. Variable shifts compile into
loops that carry the bits across multiple 8-bit registers.

This small optimization increases the matrix scan rate on my keyboard
from 598 to 628.
@chadaustin
Copy link
Author

Note that the per-key debouncers would also benefit from this optimization, but the impact is smaller.

@tzarc tzarc changed the base branch from master to develop October 26, 2021 20:13
@tzarc
Copy link
Member

tzarc commented Oct 26, 2021

Retargeted against develop as it's a core change.

@tzarc tzarc requested a review from a team October 26, 2021 20:14
@tzarc tzarc requested a review from a team October 26, 2021 20:32
@drashna drashna merged commit ee23aae into qmk:develop Oct 27, 2021
ptrxyz pushed a commit to ptrxyz/qmk_firmware that referenced this pull request Apr 9, 2022
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.

3 participants