reading-localstorage

JavaScript performance comparison

Revision 3 of this test case created

Info

See https://twitter.com/#!/johnallsopp/status/177964915632513024

Preparation code

<script>
localStorage.clear();

for(var i = 0; i < 100; i++)
  localStorage.setItem(i, 'Value ' + i);
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
call to getItem
for(var i = 0; i < localStorage.length; i++)
  var value = localStorage.getItem(i);
pending…
index on localStorage
for(var i = 0; i < localStorage.length; i++)
  var value = localStorage[i];
pending…
index on getItem
for(var i = 0; i < localStorage.length; i++)
  var value = localStorage.getItem[i];
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment