adrianmay / rhaboo

Persistent JavaScript Objecs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Try less grainy storage scheme

adrianmay opened this issue · comments

There's a speed advantage to using JSON.stringify because it's native code. The advantage is still attractive even if one of the fussy forms of stringify is used. In this case, it would certainly be necessary to use a replacer function to blot out the object valued properties, otherwise the multiple-reference-to-same-object behaviour would go pear shaped. But perhaps the speed penalty for using the replacer function is so bad that editing the string afterwards might be better.

Having one property per LS slot is quite extreme. The other extreme is to put all properties of a given object into a single slot, where the value of an object-valued property is a reference to another slot. Between the two extremes, there might be some hashtable-like approach with a handful of properties per slot.

Firstly, the other extreme needs to be performance tested. The results will influence what happens next.

This is done - it's the rocks version. But it's not much faster and I still recommend the sand version.