Always inline fastPinGetPinmap to speed pin sets #2251
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Always inline fastPinGetPinmap in order to speed pin set
Also add test to catch unintentional slowing of pin set in the future.
Problem
For some users, calling
pinSetFast
orpinResetFast
was noticeably slower on 2.0.0-rc.4 or later than on earlier releases.Solution
The 2.0.0 development line worked around an issue with initialization order by changing the way the HAL pin map was initialized and subsequently accessed. This introduced some overhead in each call to fastPinGetPinmap. We reduce that overhead here by always inlining
fastPinGetPinmap()
.References
Steps to Test
Added a test to
/user/tests/wiring/no_fixture/fastpin.cpp
to set a limit to the allowable ticks. Tested on Electron 2g.Completeness