lsperf

JavaScript performance comparison

Test case created by An

Preparation code

<script>
var small = "XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-XXXXXXXXX-";
var medium = small + small + small + small + small;
var large = medium + medium;

</script>
<script>
  Benchmark.prototype.setup = function() {
    localStorage.setItem("a", small);
    localStorage.setItem("b", small);
    localStorage.setItem("c", small);
    localStorage.setItem("d", small);
    localStorage.setItem("e", small);
    localStorage.setItem("f", small);
    localStorage.setItem("g", small);
    localStorage.setItem("h", small);
    localStorage.setItem("i", small);
    localStorage.setItem("j", small);
   
    localStorage.setItem("z", large);
  };

  Benchmark.prototype.teardown = function() {
    localStorage.clear();
  };
</script>
 

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
lsps
var value;
value = localStorage.getItem("a");
value = localStorage.getItem("b");
value = localStorage.getItem("c");
value = localStorage.getItem("d");
value = localStorage.getItem("e");
value = localStorage.getItem("f");
value = localStorage.getItem("g");
value = localStorage.getItem("h");
value = localStorage.getItem("i");
value = localStorage.getItem("j");
 
pending…
lspl
var value;
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
value = localStorage.getItem("z");
 
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment