-
-
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
Force inline lightweight methods to improve flash size #1990
Comments
This is compiled using avr-gcc 7.3 (now current Arduino or Microchip) The compiler generates the following code for the size command:
Which it finds too big to inline. |
Here are my measurements with ArduinoJson's examples:
It doesn't save much, but these programs are really small. |
My program is around 75k on an Atmega128: going from 74900 to 74750. The biggest improvement will be getting rid of the duplicate |
While going through the assembly, I noticed there were 2 "identical"
toJson
functions of about 100 bytes:Looking more in detail, the only difference was:
If you look into what the
size()
call actually does:So, if I force that inline:
My duplicates become much smaller (almost half), in total my code shrinks 150 bytes:
Now my duplicates are really duplicate, so perhaps it has something to do with where they are compiles?
The text was updated successfully, but these errors were encountered: