localstorage vs amplify.store vs storage.js vs jStorage (v8)

Revision 8 of this benchmark created by Kyle Chadha on


Description

Comparing the speed of Store.JS, Amplify.Store, jStorage, and vanilla localStorage

Preparation HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<script type="text/javascript" src="https://rawgit.com/douglascrockford/JSON-js/master/json2.js">
</script>
<script type="text/javascript" src="https://rawgit.com/appendto/amplify/master/src/store.js">
</script>
<script type="text/javascript" src="https://rawgit.com/marcuswestin/store.js/master/store.min.js">
</script>
<script type="text/javascript" src="https://rawgit.com/andris9/jStorage/master/jstorage.js">
</script>

Teardown


    amplify.store("a1", null);
    amplify.store("a2", null);
    amplify.store("a3", null);
    localStorage.removeItem('l1');
    localStorage.removeItem('l2');
    localStorage.removeItem('l3');
    $.jStorage.deleteKey('j1');
    $.jStorage.deleteKey('j2');
    $.jStorage.deleteKey('j3');
  

Test runner

Ready to run.

Testing in
TestOps/sec
store.js
$(function() {
  store.set("s1", 1);
  store.set("s2", 2);
  store.set("s3", 3);
  var svar1 = store.get("s1");
  var svar2 = store.get("s2");
  var svar3 = store.get("s3");
});
ready
Amplify.Store
$(function() {
  amplify.store("a1", 1);
  amplify.store("a2", 2);
  amplify.store("a3", 3);
  var avar1 = amplify.store("a1");
  var avar2 = amplify.store("a2");
  var avar3 = amplify.store("a3");
});
ready
Vanilla LocalStorage
$(function() {
  localStorage.setItem('l1', 1);
  localStorage.setItem('l2', 2);
  localStorage.setItem('l3', 3);
  var lvar1 = localStorage.getItem('l1');
  var lvar2 = localStorage.getItem('l2');
  var lvar3 = localStorage.getItem('l3');
});
ready
jStorage
$(function() {
  $.jStorage.set('j1', 1);
  $.jStorage.set('j2', 2);
  $.jStorage.set('j3', 3);
  var jvar1 = $.jStorage.get('j1')
  var jvar2 = $.jStorage.get('j2')
  var jvar3 = $.jStorage.get('j3')
});
ready

Revisions

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