Sessionstorage performance for different value sizes

JavaScript performance comparison

Revision 3 of this test case created by Sam

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    function bytes (powtwo) {
        var output = ".";
        for (var i = 0; i < powtwo; i++) output = output.concat(output);
        return output;
    }
   
    byte_1 = bytes(0);
    byte_128 = bytes(7);
    byte_1024 = bytes(10);
    byte_16384 = bytes(14);
    byte_131072 = bytes(17);
    byte_1048576 = bytes(20);
};

Benchmark.prototype.teardown = function() {
    sessionStorage.clear();
};
</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
writing 1 byte
window.sessionStorage.setItem("test", byte_1);
pending…
writing 128 bytes
window.sessionStorage.setItem("test", byte_128);
pending…
writing 1,024 bytes
window.sessionStorage.setItem("test", byte_1024);
pending…
writing 16384 bytes
window.sessionStorage.setItem("test", byte_16384);
pending…
writing 131072 bytes
window.sessionStorage.setItem("test", byte_131072);
pending…
writing 1048576 bytes
window.sessionStorage.setItem("test", byte_1048576);
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