-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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: Save flash by not inlining SubscriptionInterval::copy() #23395
Conversation
Saves 17.3 kilobytes of flash 😮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one!
As a quick check take a look at |
ok, doing that. |
@dagar ok, I tested two boards with logging on SD card started. |
epic! I wonder how much more flash is out there waiting to be saved... 🤑 |
Quite a lot, but at some point there will be performance tradeoffs. Take a look at |
Solved Problem
When porting the fix from #23384 to 1.15 with #23392 I saw that it uses 2.5 kilobytes more flash which is totally unexpected.
Big thanks to @niklaut who decompiled the binary and found that the unexpected impact comes from inlining the functions everywhere.
Solution
Move
updated()
,update()
,copy()
fromSubscriptionInterval
into a separate cpp file such that they are not inlined everywhere.Saves 17.3 kilobytes of flash 😮
Changelog Entry
Alternatives
Disadvantage is probably slightly more run time but I'd assume it's not worth that much flash 👀
Test coverage
I'm testing this now.
Context