This is timely. I've been working with window.localStorage for the
past couple months now and initially I wrote a nice and simple wrapper
for it that also provides an in-memory cache where clients do not
support window.localStorage. I rewrote it a couple times since then
and thought I had something useable.

Last week I did some tests on Firefox 3.5 and Safari 4 on my machine.
For 10,000 iterations it turns out that Safari can do setItem('key',
'value') at a rate of about 1 item every 0.0033ms. Firefox on the
other hand takes 2ms per item. From what I've read, it seems that
Safari's implementation uses an in-memory cache before writing to disk
but that Firefox writes directly to disk and gets IO-bound.

In other words, setting about 1000 objects to local storage takes
about 3.3 milliseconds in Safari and 2 seconds(!) in Firefox.

So I've now rewritten the wrapper to use an internal queue, throttle
localStorage use based on browser, and provide asynchronous get, set
and unset methods with callback options.

Hope this helps. Have you found similar results?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to