'Localstorage' reading

JavaScript performance comparison

Revision 2 of this test case created

Info

Test for benchmarking localstorage reading

Preparation code

<script>
  localStorage.setItem("foo", "body { background: blue; margin: 10px; padding: 10px; color: black; text-decoration: none; }");
 
  var largeValue = "Foo";
  for (var i=0;i<3413;i++)
  {
    largeValue += "Bar";
  }
  localStorage.setItem("largeFoo", largeValue);

  var value;
</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
Read from getItem()
value = localStorage.getItem('foo');
pending…
Reading from localStorage index
value = localStorage['foo'];
pending…
Reading from localStorage property
value = localStorage.foo
pending…
Reading a large value with getItem()
value = localStorage.getItem('largeFoo');
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