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: make available(pipe) depend on available(void) #1007

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

2bndy5
Copy link
Member

@2bndy5 2bndy5 commented Oct 26, 2024

I've been code golfing in rust again...

By making available(pipe) call available(void), we can get the same behavior without instantiating a dummy byte (RF24_FETCH_NO_PIPE) . This way available(pipe) also doesn't need to check the pipe parameter's value; it just mutates it because that is the overload's purpose.

This should decrease the compile size in general, more for any app that doesn't actually call available(pipe).

I've been code golfing in rust again...

By making `available(pipe)` call `available(void)`, we can get the same behavior without instantiating a dummy byte (`RF24_FETCH_NO_PIPE`) . This way `available(pipe)` also doesn't need to check the `pipe` parameter's value; it just mutates it because that is the overload's purpose.

This should decrease the compile size for any app that doesn't actually call `available(pipe)`.
@2bndy5 2bndy5 force-pushed the swap-available-order branch from 6fb1e5e to a11d593 Compare October 26, 2024 10:40
Copy link
Contributor

Memory usage change @ a11d593

Board flash % RAM for global variables %
arduino:avr:nano 💚 -76 - 0 -0.25 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrzero ❔ -60 - +4 -0.02 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/GettingStarted
flash
% examples/GettingStarted
RAM for global variables
% examples/AcknowledgementPayloads
flash
% examples/AcknowledgementPayloads
RAM for global variables
% examples/ManualAcknowledgements
flash
% examples/ManualAcknowledgements
RAM for global variables
% examples/StreamingData
flash
% examples/StreamingData
RAM for global variables
% examples/MulticeiverDemo
flash
% examples/MulticeiverDemo
RAM for global variables
% examples/InterruptConfigure
flash
% examples/InterruptConfigure
RAM for global variables
% examples/scanner
flash
% examples/scanner
RAM for global variables
% examples/encodeRadioDetails
flash
% examples/encodeRadioDetails
RAM for global variables
%
arduino:avr:nano -16 -0.05 0 0.0 -6 -0.02 0 0.0 -12 -0.04 0 0.0 0 0.0 0 0.0 -12 -0.04 0 0.0 -76 -0.25 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
arduino:samd:mkrzero 4 0.0 0 0.0 0 0.0 0 0.0 -16 -0.01 0 0.0 -44 -0.02 0 0.0 4 0.0 0 0.0 -44 -0.02 0 0.0 -60 -0.02 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,examples/GettingStarted<br>flash,%,examples/GettingStarted<br>RAM for global variables,%,examples/AcknowledgementPayloads<br>flash,%,examples/AcknowledgementPayloads<br>RAM for global variables,%,examples/ManualAcknowledgements<br>flash,%,examples/ManualAcknowledgements<br>RAM for global variables,%,examples/StreamingData<br>flash,%,examples/StreamingData<br>RAM for global variables,%,examples/MulticeiverDemo<br>flash,%,examples/MulticeiverDemo<br>RAM for global variables,%,examples/InterruptConfigure<br>flash,%,examples/InterruptConfigure<br>RAM for global variables,%,examples/scanner<br>flash,%,examples/scanner<br>RAM for global variables,%,examples/encodeRadioDetails<br>flash,%,examples/encodeRadioDetails<br>RAM for global variables,%
arduino:avr:nano,-16,-0.05,0,0.0,-6,-0.02,0,0.0,-12,-0.04,0,0.0,0,0.0,0,0.0,-12,-0.04,0,0.0,-76,-0.25,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0
arduino:samd:mkrzero,4,0.0,0,0.0,0,0.0,0,0.0,-16,-0.01,0,0.0,-44,-0.02,0,0.0,4,0.0,0,0.0,-44,-0.02,0,0.0,-60,-0.02,0,0.0,0,0.0,0,0.0

@2bndy5
Copy link
Member Author

2bndy5 commented Oct 26, 2024

This should decrease the compile size in general

Odd, there's a 4 byte increase in flash on ATSAMD21 for the examples that use available(pipe). Luckily, that's still negligible for that chip. The changes in ATMega328 flash consumption are all favorable as expected.

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.

1 participant