smalls strings inside json_objects had a high overhead because dynamic memory allocation was needed for each of them. This also meant that the pointer needed to be updated. This is now changed so that small strings can directly be stored inside the json_object. Note that on the regular 64 bit machines a pointer takes 8 bytes. So even without increasing memory, we could store string up to 7 bytes directly inside the object. The max size is configurable. I have selected up to 31 bytes (which means a buffer of 32 including the NUL byte). This brings a 24-bytes memory overhead, but I consider that still useful because the memory allocator usually also has quite some overhead (16 bytes) for dyn alloced memory blocks. In any case, the max buffer size can be tweaked via #define.
1.2 KiB
1.2 KiB