-
-
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
Memory savings #1650
Comments
Hi @lultimouomo, Please apologize for the long delay; I wanted to take the time to give you a complete answer.
This is perfectly normal! Remember that ArduinoJson is a serialization library, not a generic container library. The main reason for not using
This statement is exaggerated: 16-bytes on a device with 320 KB of RAM (and often 4MB of PSRAM) is a reasonable number. From my experience, many users define ARDUINOJSON_USE_DOUBLE and
Why not? After all, very few users are interested in this feature, so we could make it optional.
The early versions of ArduinoJson had only a
I intended to add SSO in v7, but I can include it in the v6 branch.
Thanks for offering your help. In summary, I don't think reducing the size of
Apart from that, I'm all in favor of SSO; it's been on my (secret) backlog for a long time, and I'll probably implement it in v6. PS: I deleted your messages in #1343 because they were irrelevant to the conversation; please open a new issue so we can work on your problem without polluting another thread. Thank you for your understanding. Best regards, |
That's very large for a An alternative to #1074 (which is still a problem when the estimate |
The main reason for not using JsonDocument as a container class is the monotonic allocator. Does this mean using it as container class becomes a valid use case in v7? |
Yes, you can use long-lived |
Migrated to v7 today. Looks very good! I had a memory usage / capacity watch in my ui but removed that and heap usage looks better than before ! |
Hi Benoit,
I noticed that ArduinoJson needs a pretty sizeable amount of memory for each object (16 bytes on ESP32); even by using zero-copy I find that I can need more memory for the
JsonDocument
than for the serialized Json.I see that a lot of work has been put into saving memory, but I was wondering if you would consider PRs for the following changes:
make support for
serialized()
optionalBy removing support for
serialized()
via a preprocessor definition we could then removeasRaw
fromVariantContent
and also remove_tail
fromCollectionData
and reduce the size ofVariantContent
to the size of a pointer/float. Removing_tail
would mean that to add a collection element we need to walk the linked list each time, but in certain situations it could be a reasonable tradeoff.add support for short strings
In case of very short strings we could apply short-string optimization and store up to 3 characters for 32bit archs and 7 characters for 64bit archs (+1 for null termination) in place of the 'char *'. This is probably a marginal improvement, especially because 64bit archs where it can be applied more easily don't probably need it as much. Also it won't matter for zero-copy.
The text was updated successfully, but these errors were encountered: