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

Feature request: excluding float support #1404

Open
jputcu opened this issue Oct 13, 2020 · 3 comments
Open

Feature request: excluding float support #1404

jputcu opened this issue Oct 13, 2020 · 3 comments

Comments

@jputcu
Copy link

jputcu commented Oct 13, 2020

Would it be interesting to add a configuration to disable support for floats to reduce the flash size?
In my arduino code I avoid using them but when I check the listing file I see many json calls to float functions.
Or could it be possible to let the compiler disable support because I never ask for a float while parsing the Json?

@bblanchon
Copy link
Owner

Hi @jputcu,

Would it be interesting to add a configuration to disable support for floats to reduce the flash size?

First, we must make sure that it's worth the effort.
Can you try to remove some parts of the library to see how many bytes you can trim?

could it be possible to let the compiler disable support because I never ask for a float while parsing the Json?

In ArduinoJson 5, this was the case because the library stored all values as strings and parsed floats "lazily".
However, in ArduinoJson 6, the library eagerly parses float values, so the compiler cannot eliminate the code.
(This change significantly reduced string duplication and enabled the JSON to MsgPack use case.)

Best regards,
Benoit

@jputcu
Copy link
Author

jputcu commented Oct 18, 2020

Sure, I will try to remove the floats in ArduinoJson and see how much that gives me. Could indeed be that it won't be much, we'll see.

@jputcu
Copy link
Author

jputcu commented Feb 11, 2021

I currently don't have the time to figure it out, so you could close the issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants