pure localstorage vs cookie vs jstorage.js (v3)

Revision 3 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"
      }
    };
    localStorage['foo'] = JSON.stringify(obj);
    Echo.Cookie.set('foo', JSON.stringify(obj));
    $.jStorage.set('foo', obj);
    lscache.set('bar', obj);
    sessionStorage.setItem('foo', JSON.stringify(obj));

Test runner

Ready to run.

Testing in
TestOps/sec
localstorage
JSON.parse(localStorage['foo']);
ready
cookie
JSON.parse(Echo.Cookie.get('foo'));
ready
jstorage.js
$.jStorage.get('foo');
ready
lscache.js
lscache.get('bar');
ready
sessionStorage
JSON.parse(sessionStorage.getItem('foo'));
ready

Revisions

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