-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
use less stack on Print::printNumber #528
base: master
Are you sure you want to change the base?
use less stack on Print::printNumber #528
Conversation
1a61a90
to
8e67a64
Compare
Memory usage change @ 8e67a64
Click for full report table
Click for full report CSV
|
Hi @DEvil0000. Thanks for your pull request. I'm just commenting to let you know the failure of the "Spell Check" workflow run is not related to the changes you proposed (it was caused by a recent automated update of the spellcheck dictionary) and won't affect the review of the PR. I have now fixed the problem in the |
added compile flag to disable those additional optimized implementations
8e67a64
to
870432e
Compare
@PaulStoffregen sorry, looks like I was a bit sleepy when opening the PR. I fixed the implementation with the first two commits and added improved versions for base 2 and base 16 which one can disable by compiler define flag in the third commit. |
Memory usage change @ 870432e
Click for full report table
Click for full report CSV
|
Memory usage change @ fd90b45
Click for full report table
Click for full report CSV
|
Memory usage change @ 66645a2
Click for full report table
Click for full report CSV
|
Memory usage change @ e5c727e
Click for full report table
Click for full report CSV
|
… optimization due to it being basically const then
Memory usage change @ a81294f
Click for full report table
Click for full report CSV
|
Yeah, catering for all the bases with one function messes it up there. When printing decimal only, much smaller buffer is needed(11bytes vs 33bytes). |
The issue with printNumber is that it uses a lot of stack quite unexpectedly. This makes it basically unusable on a attiny.
I suggest doing the naive implementation as it's done with float print.
I think the Autor was hoping for a more optimized write call Implementation in the over-writable write call with a long buffer. I think this is too late to get it more efficient for most platforms anyway. Another option of course would be changing the API and adding a parameter for this or adding a define to switch the default Implementation.