Shared publicly  - 
9
6
Paul Irish's profile photoSeth Ladd's profile photoMalte Ubl's profile photo
4 comments
 
Agreed, synchronous APIs are bad. Especially synchronous IO APIs.
 
Numbers please (comparing to alternatives)! Also, when comparing the performance to an HTTP request things look much better :)
LocalStorage is Safari is unbelievable fast (same process RAM access fast), so the premise of the first sentence is most certainly wrong. I agree that it is slow in Chrome. Not sure about Firefox where it could be fast (because no RPC is necessary like in Safari)
 
Things every developer should know part 1: "If you can do it 100000 times per second it probably does not involve many disk seeks" :)
My assumption with the non-chrome webkit implementation was always that
- there will be race conditions that lead to data loss through last-wins override
- when something goes wrong (Crash), no data will actually ever be written or might even be written incomplete
I think those are awesome tradeoffs for speed. LocalStorage should have been specced from the start as Redis like
- all data is always in memory
- when memory is full stuff gets thrown away randomly
- every couple seconds an image of what is in memory gets written to disk in a separate thread. When the browser crashes before that you loose al your data.
This seems to be the only constraints under which a sync persistence API could really work in the browser.
Add a comment...