Description
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()
optional
By removing support for serialized()
via a preprocessor definition we could then remove asRaw
from VariantContent
and also remove _tail
from CollectionData
and reduce the size of VariantContent
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.