Bnaya / objectbuffer

JavaScript Object like api, backed by an arraybuffer
MIT License
171 stars 5 forks source link

Global string dedup cache #123

Open Bnaya opened 4 years ago

Bnaya commented 4 years ago

Strings have reference counting, and we save duplicate strings once for every save operation. It's easy for us, because we create cache at the beginning of the save operation.

But can we do that across different save operations? If we keep that cache aways alive, it might get stale, leak memory, and won't be useful for other threads.

So the "ultimate" and complex solution would be global string registry inside the objectbuffer memory (To hold all strings in additional data struct that we can locate them easily)