JSON Parsing Performance (v8)

Revision 8 of this benchmark created on


Description

Testing DataStorage.js performance increases for repeatedly accessing Objects in localStorage.

datastorage.js

Preparation HTML

<script src="https://raw.github.com/marcneuwirth/datastorage.js/master/dataStorage.js"></script>

Setup

localStorage = localStorage || {};
    var storageArray = {};
    
    //from http://json.org/example.html
    var med = {
    "web-app": {}
    };
    
    storageArray['med'] = med;
    localStorage['med'] = JSON.stringify(med);

Test runner

Ready to run.

Testing in
TestOps/sec
Small: JSON Parse
if(localStorage['small'] !== undefined){
  var d = JSON.parse(localStorage['small']);
}
ready
Small: No Parse Lookup
if(storageArray['small'] !== undefined){
  var d = storageArray['small'];
}
ready
Small: DataStorage
var d = dataStorage.getData('small');
ready
Med: JSON Parse
if(localStorage['med'] !== undefined){
  var d = JSON.parse(localStorage['med']);
}
ready
Med: No Parse Lookup
if(storageArray['med'] !== undefined){
  var d = storageArray['med'];
}
ready
Med: DataStorage
var d = dataStorage.getData('med');
ready
Large: JSON Parse
if(localStorage['large'] !== undefined){
  var d = JSON.parse(localStorage['large']);
}
ready
Large: No Parse Lookup
if(storageArray['large'] !== undefined){
  var d = storageArray['large'];
}
ready
Large: DataStorage
var d = dataStorage.getData('large');
ready

Revisions

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