'Localstorage' reading

JavaScript performance comparison

Revision 7 of this test case created

Info

Test for benchmarking localstorage reading

Preparation code

<script>
  var smallValue = "my small value";

  var largeValue = "1234567890";
  for (var i = 1; i < 500; i++) // 10*2*500 bytes = 10kb
  {
    largeValue += "1234567890";
  }
  var large2Value = largeValue + largeValue; // 20kb
  var large3Value = large2Value + large2Value; // 40kb
  var large4Value = large3Value + large3Value + large3Value + large3Value; // 160kb
  // LocalStorage
  localStorage.setItem("small", smallValue);
  localStorage.setItem("large", largeValue);
  localStorage.setItem("large2", large2Value);
  localStorage.setItem("large3", large3Value);
  localStorage.setItem("large4", large4Value);

  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('small');
pending…
Reading a large value with getItem()
value = localStorage.getItem('large');
pending…
Reading large value 2
value = localStorage.getItem('large2');
pending…
Reading large value 3
value = localStorage.getItem('large3');
pending…
Reading large value 4
value = localStorage.getItem('large4');
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