Diggsey / ijson

More efficient alternative to `serde_json::Value` which saves memory by interning primitive values and using tagged pointers.
Apache License 2.0
127 stars 14 forks source link

Avoid intern short Strings #24

Open gkorland opened 1 year ago

gkorland commented 1 year ago

In case the string is less than 8 bytes, will storing the string and not a pointer will save some space?

Also in some of the cases interning the IString doesn't worth it since the value is unique and in fact we just add overhead.

Diggsey commented 1 year ago

It's possible this could work on 64-bit platforms. But it would add a fair amount of complexity. Could maybe limit it to 7 characters which would allow the low bits to still contain the tag value for string, and the length could also be stuffed into that byte in the non-tag space.