-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Minimize header use, move Ticker function definitions into cpp file #6496
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
Conversation
d7051cd
to
9b6eb9e
Compare
e41e673
to
c85b86f
Compare
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.
In the current code, all methods that take a "seconds" arg are routed through a single _attach_s() which is where the float multiplication is done. This is to have the multiplication in a single place, because on the ESP float arithmetic is done in sw.
In other words, the current code pays the price of an additional forwarder method to reduce the duplication of the generated code for the float multiplication.
On the other hand, you moved the methods out of the header.
Please check size of the bins for current code vs. this PR for a case that uses many of the methods.
@devyte Are you certain that float multiplication is even inlined? |
@dok-net I see you reverted the move from h to cpp. Did you compare the bin size lf your current proposal vs. unifying the float mult in a single attach method as is currently the case? |
@devyte My comment in the ESP32 PR was more informative: better than 204 bytes saved by inlining in header As to your precise question, I don't see the issue you're hinting at, as far as I can tell from objdump either, the multiplication is not unrolled/inlined, therefore it's rather insignificant in how many places a That said, I don't expect any single sketch to use all modes of the Ticker at once, YMMV if you do. But for using two Ticker instances, one with |
@dok-net the relevant code is in effect only when using attach() with a float arg. |
@devyte Naturally, I've tested all sort of combinations, also on ESP32, where |
@devyte CI is broken - not by me (?) |
The pleasures of DevOps and needing sources from 15 different projects. The Python version in the Win VM was changed, and installed into a different dir than before. Fixed now, hopefully, permanently. |
9ac5425
to
4a3c9e9
Compare
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.
Ticker.cpp was moved, so the diff is visible.
ticker.h was not moved, it was (D)eleted in one place and (A)dded in the new one. Therefore, the diff can't be seen here in the PR, and instead the file is fully red in the origin and fully green in the destination.
Please fix that, or redo the PR, so that I can review.
@devyte It's not on purpose, git doesn't recognize it as a move, the internal difference probably is to large. Could you do a local diff by hand, please? |
0d0a604
to
d227aaa
Compare
This is a corresponding port of ESP32 review results.