LocalStorage vs indexedDB

Benchmark created on


Setup

var db;

// Setup IndexedDB
var request = indexedDB.open('testDB', 1);

request.onupgradeneeded = function(event) {
    db = event.target.result;
    var objectStore = db.createObjectStore('testStore', { keyPath: 'id' });
};

request.onsuccess = function(event) {
    db = event.target.result;
};

Test runner

Ready to run.

Testing in
TestOps/sec
write to local storage
localStorage.set("testkey", JSON.stringify('This is a sample value for testing.' ));
ready
write to indexed db
 var transaction = db.transaction(['testStore'], 'readwrite');
    var objectStore = transaction.objectStore('testStore');
    var request = objectStore.put({ id: 'testKey', value: 'This is a sample value for testing.' });
};
ready

Revisions

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