It’s been some time since I last updated this blog, mostly because there’s plenty going on these days. However, there’s something I’ve been wanting to publish for quite some time now: The results of the localStorage performance tests I ran several weeks ago. As I am currently working on performance tests for Mozilla’s IndexedDB implementation, which is available in latest Minefield releases, I got reminded that there are still other results to publish – so, here we go:
Among other tests, the main thing I wanted to know is how long does it take to read or write 1000 entries from/to localStorage. The keys were of the form “key000”, the values “val000”, with increasing numbers. So the tests were using minimal data – only 6 bytes – but the results are still useful to get an idea of how it goes – and how the browsers perform compared to each other.
Desktop
All test were run on a Mac Mini. Opera and IE were tested on a virtual machine, so there might be an additional performance penalty based on virtualization. However, here are the numbers (average time needed to run the respective method 1000 times):
Safari 4:
– getItem: 1.4ms
– setItem: 1.7ms
– key: 0.8ms
Chrome:
– getItem: 240ms
– setIem: 280ms
– key: 230ms
Firefox:
– getItem: 77ms
– setItem: 2100ms
– key: 25ms
Opera:
– getItem: 19ms
– setItem: 20ms
– key: 18ms
IE8:
– getItem: 5ms
– setItem: 72ms
– key: 3.6ms
Mobile
As we can see, Safari is lightening fast. That made me want to run the tests on a mobile phone that has a modern Safari browser. I took an HTC Desire, wich comes with Android 2.1, and thus has a Safari capable of localStorage. Here are the results:
HTC Desire:
– getItem: 16.4ms
– setItem: 19.5ms
– key: 8.7ms
This is pretty amazing, considering that it is a phone. It still beats most of the browseres on the desktop.
If I find that test page again (uh, yeah, it’s lost somehow), I’ll run the tests again with newer browser releases and publish the link here, so you can run the tests yourself.