pure localstorage vs cookie vs jstorage.js (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="https://raw.github.com/EchoAppsTeam/js-sdk/master/src/cookie.js">
</script>
<script src="https://raw.github.com/andris9/jStorage/master/jstorage.js">
</script>
<script src="https://raw.github.com/pamelafox/lscache/master/lscache.js">
</script>

Setup

var obj = {
      "number": 123,
      "line": "some string",
      "array": [1,
      {}, [], "str"],
      "obj": {
        "test": "foo"
      }
    };

Test runner

Ready to run.

Testing in
TestOps/sec
localstorage
localStorage['foo'] = JSON.stringify(obj);
ready
cookie
Echo.Cookie.set('foo', JSON.stringify(obj));
ready
jstorage.js
$.jStorage.set('foo', obj);
ready
lscache.js
lscache.set('bar', obj);
ready
sessionStorage
sessionStorage.setItem('foo', JSON.stringify(obj));
ready

Revisions

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