IndexedDB vs localStorage

JavaScript performance comparison

Revision 13 of this test case created by

Preparation code

<script>
  var small, large, idb, websql, ls;

  // data setup
  small = 'test';
  large = '';
  for (var i = 0; i < 10000; i++) large += '1234567890';

  // store setup
  window.indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
  var request = indexedDB.open("benchmark");
  request.onsuccess = function(e) {
    var v = "1.0";
    idb = e.target.result;
    if (v != idb.version) {
      var setVrequest = idb.setVersion(v);
      setVrequest.onsuccess = function(e) {
        var store = idb.createObjectStore("benchmark");
        e.target.transaction.oncomplete = function() {
          var trans = idb.transaction(["benchmark"], "readwrite");
          var store = trans.objectStore("benchmark");
          store.add(small, 1);
          store.add(large, 2);
        };
      };
    };
  };

  ls = window.localStorage;
  ls.clear();
  ls[1] = small;
  ls[2] = large;

  websql = openDatabase('benchmark', '1.0', '', 1 * 1024 * 1024);
  websql.transaction(function(tx) {
    tx.executeSql('DROP TABLE IF EXISTS benchmark;');
    tx.executeSql('CREATE TABLE benchmark (id, value);');
    tx.executeSql('INSERT INTO benchmark (id, value) VALUES (?, ?)', [1, small]);
    tx.executeSql('INSERT INTO benchmark (id, value) VALUES (?, ?)', [2, large]);
  });
</script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
localStorage read small data
var value = ls[1];
pending…
localStorage read large data
var value = ls[2];
pending…
IDB read small data
// async test
idb.transaction("benchmark").objectStore("benchmark").get(1).onsuccess = function(event) {
  deferred.resolve();
};
pending…
IDB read large data
// async test
idb.transaction("benchmark").objectStore("benchmark").get(2).onsuccess = function(event) {
  deferred.resolve();
};
pending…
WebSQL read small data
// async test
websql.transaction(function(tx) {
  tx.executeSql('SELECT * FROM benchmark WHERE id=?', [1], function(t1, r1) {
    deferred.resolve();
  });
});
pending…
WebSQL read large data
// async test
websql.transaction(function(tx) {
  tx.executeSql('SELECT * FROM benchmark WHERE id=?', [2], function(t1, r1) {
    deferred.resolve();
  });
});
pending…

Compare results of other browsers

Revisions

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

2 Comments

; commented :

l

aa commented :

mt1125 http://www.coachoutletmalls.us.com http://www.pandora-uk.me.uk http://www.monclerjacketsuk.org.uk http://www.burberryoutletsale.com.co http://www.ralphlaurensaleclearance.org.uk http://www.ugg-boots.net.co http://www.uggs--canada.ca http://www.coach-outlets.us.com http://www.uggsoutletclearance.us.com http://www.canadiangoose.us.com http://www.longchamphandbagsuk.org.uk http://www.ferragamo-outlet.us.com http://www.uggsoutlet.cc http://www.katespade.in.net http://www.longchampoutletus.us.com http://www.ugg-boots.org.uk http://www.jordanretro.name http://www.cheapjerseyswholesalefromchina.us.com http://www.ugg-uk.org.uk http://www.uggoutlets.in.net http://www.toryburchoutletonline.com.co http://www.pandora-outlet.us.com http://www.harden-vol1.com http://www.adadassuperstar.com http://www.louisvuittonoutlet.us.org http://www.cheapuggs-boots.us.com http://www.ralphlaurenoutletonline-polo.us.com http://www.cheapuggs.net.co http://www.columbiasportswear.us.com http://www.uggs-boots.fr http://www.pandora-charms.us.org http://www.oakley--sunglasses.us.org http://www.thenorthfacejacketsoutlet.us.com http://www.moncleroutlet.me.uk http://www.coachoutletonlinecoachfactoryoutlet.us.com http://www.ralph-laurenuk.org.uk http://www.yeezyboost.org.uk http://www.moncleroutletonlines.us.com http://www.ugg.net.co http://www.nikeoutlet.us.com http://www.coachcanadaoutlet.ca http://www.korsmichaeloutlet.us.com http://www.canadagoosejacketscanada.ca http://www.adidasoutlet.us.com http://www.ugg-outletstores.us.com http://www.nike-store.us.com http://www.canadagooseukjackets.org.uk http://www.uggaustraliaoutlet.com.co http://www.burberry-outlet-canada.ca http://www.coach-factoryoutlet-online.us.com http://www.canadagooseoutletcanada.com.co http://www.outletmichaelkorsonline.us.com http://www.adidasnmd.us.org http://www.cheapmlbjerseyschina.us.com http://www.uggbootsonline.us http://www.mlbjerseyscheap.us.com http://www.timberland-outlets.us http://www.adidasnmd-shoes.us http://www.cheap-raybans.us.com http://www.uggoutlet.cc http://www.supremeclothing.us.org http://www.canadagooseoutletonlines.us http://www.coach-factoryoutletonline.us.org http://www.hermes-handbags.us http://www.canadagooseoutletjackets.ca http://www.canadagoosejacketsoutlet.name http://www.uggs-outlets.com.co http://ugg.bootsoutlet.us.com http://www.uggcanadaboots.ca http://www.uggshoes.us.com http://www.salvatoreferragamoshoes.us.com http://www.pandora.us.com http://www.airjordans.us.com http://www.canadagoosejacketscoats.org.uk http://www.yeezyboost-350.co.uk http://www.oakley.nom.co http://www.moncler-outlet.us.org http://www.coachfactory-outlet.us.com http://www.michaelkorsoutlets.us.com http://www.canadagoosejackets-outlet.us http://www.supremeclothing.org.uk http://www.uggsaustraliaoutlet.us.com http://www.uggsbootsonline.us.com http://www.canadagooseoutletjackets.us http://www.guccioutlets.us.org http://www.coachfactoryoutletsonlines.us.com http://www.outletcanadagoose.us http://www.jacketscanadagoose.com.co http://www.outletcoachoutlet.us.com http://www.canadagooseukjackets.me.uk http://www.adidas-yeezyshoes.us.com http://www.canadagooseoutletjackets.com.co http://www.michaelkorsoutletclearance.in.net http://www.adidas-shoes.us.com http://www.canadagooseoutlet.cc http://www.uggaustraliaoutlet.in.net http://www.louisvuitton-outletonline.us.com http://www.coachoutlet-onlinesale.us.com http://www.polooutlets.us.org http://www.coachfactory-outletstore.us.com http://www.ralphlauren.me.uk http://www.cheapnfljerseysofficial.us.com http://www.canadagooseoutletstores.us http://www.ralphlaurenoutlet.us.org http://www.hermesbirkin.in.net http://www.cheapoakleysunglassesofficial.us.com http://www.hermesbag.us.com http://www.coachoutletcanada.ca http://www.yeezyboost-350.us.com http://www.nikeairmax.in.net http://wwwcanadagoose-jacketsuk.com.co http://www.pandora-jewelryoutlet.us.com http://www.pandoracharmssaleclearance.uk http://www.ralphlaurenoutletsale.us.com http://www.uggsoutlets.name http://www.uggoutlets.name http://www.ugg-outlets.us http://www.coach-outletonlines.us.com http://www.fredperrypoloshirts.us http://www.outletlouisvuitton.us.com http://www.coachoutletstoreonline.com.co http://www.canadagooseoutlet-jackets.us http://www.burberry.us.com http://www.canadagoosejacketscanada.com.co http://www.michael-korsoutlets.us.com http://www.pandoracharms.name http://www.birkenstocks.us http://www.canadagoose-outlet.name http://www.uggbootsclearance.org.uk http://www.ralphlaurenoutlet.in.net http://www.longchamp-outlet.us.com http://www.redbottomsshoes.us.com http://www.michaelkorsoutlet1.us.com http://www.michael-korshandbags.me.uk http://www.raybansunglasses.net.co http://wwwmonclerjacketsuk.com.co http://www.yeezyboost.us.com http://www.catboots.us http://www.mulberryoutlet.org.uk http://www.coachoutlet-online.us.org http://www.canadagooseoutlets.us http://www.canadagooseoutletus.us.com http://www.nikeshoes.in.net http://www.monclerjacketsoutlet.in.net http://www.pandoracharms-uk.org.uk http://www.uggs-boots.us http://www.uggoutlet-store.us http://www.mbtshoes.name http://www.louisvuitton-outlet.us.com http://www.northfacejacketssale.us.com http://www.michaelkorsfactoryoutletsale.us.com http://www.christianlouboutinshoes.us.org http://www.raybanssunglassesoutlet.us.com http://www.polo-ralphlauren.in.net http://www.uggs-australia.it http://www.uggsoutletonlines.us.com http://www.ralphlauren-outletpolo.us.com http://www.uggs-clearance.us.com http://www.uggsboots.name http://www.canadagoosesalejackets.us.com http://www.michaelkors-outlet.ca http://www.pandoracharms.us.com http://www.monclerjacketssale.us.com http://www.supremenewyork.us.com http://www.cheapuggssale.com.co http://www.nikeoutletonline.us.com http://www.uggbootssales.us.com http://www.ralphlaurensaleclearance.me.uk http://www.cheapuggs.com.co http://www.coachhandbagsoutlet.us.com http://www.ralph-laurenoutlet.com.co http://www.guccihandbagsoutlet.us.com http://www.michaelkorsoutletonlinemichaelkors.us.com http://www.katespadehandbagsclearance.us.com http://www.canadagooseoutletjackets.us.com http://www.coachoutletsonlines.us.com http://www.uggoutlet-clearance.us.com http://www.coachoutletstoreonlineclearances.in.net http://www.pandorajewelryoutlet.in.net http://www.louboutinshoes.in.net http://www.northface-jackets.us.com http://www.jacketscanadagoose.org.uk http://www.ralphlaurenoutlet-polo.us.com http://www.tomsoutlets.us.com http://www.michaelkorsoutlet.co.uk http://www.adidas-superstar.us.com http://www.uggsoutletstoreonline.us.com http://www.vuittonlouis.us.com http://www.uggsaustralia.fr http://www.ralphlaurenuk.me.uk http://www.northfaceoutlet.us.com http://www.coach-factory-outlet.us.org http://www.uggoutletonlines.us http://www.ultraboost.us http://www.michael-korsoutlet.ca http://www.valentinoshoesoutlets.us.com http://www.canadagoosejacket.com.co http://www.uggs.net.co http://www.cheapjordan-shoes.in.net http://www.outletcoachonline.us.com http://www.cheapjordans.in.net http://www.coachoutletus.us.com http://www.cheapraybansunglassessale.us.com http://www.cheapmlbjerseys.us http://www.cheapjordans.com.co http://www.adidasyeezyshoes.us.com http://www.fitflopssale.us.com http://www.canadagooseoutlet.name http://wwwcanadagoose-uk.com.co http://www.nfljerseyscheapwholesale.us.com http://www.pandoracharms.com.co http://www.mbtshoes.us.org http://www.outletcanadagooseoutlet.us.com http://www.cheapoakleysunglasses.com.co http://www.thenorthface.us.com http://www.airjordanshoes.in.net http://www.michael-korsoutlet.us.com http://www.uggbootsoutletstores.us.com http://www.coachfactory-outletonline.us.org http://www.moncler-outlets.us.com http://www.air-jordans.us.com http://www.uggsbootscanada.ca http://www.christianlouboutinoutlet.us http://www.adidasshoe.us.com http://www.michaelkorsoutletshopping.us.com http://www.cheapuggboots.us.com http://www.adidas-outlet.us.com http://www.timberlandbootsoutlets.us.com http://www.uggsonsale.us.com http://www.uggbootsclearance.com.co http://www.ralphlaurenoutletpolo.org.uk http://www.northfacejacketsoutlet.com.co http://www.coach-outletonline.us.org http://www.adidas-nmd.us.com http://www.burberryoutlet.in.net http://www.michaelkorsoutletonlineclearance.in.net http://www.toryburchoutletonlines.us.com http://www.katespadeonlineoutlet.us.com http://www.poloralphlaurenoutletonline.us.com http://www.doudounemonclerpascher.fr http://www.uggbootsoutletsale.us.com http://www.cheapraybans.com.co http://www.cheapjordans-shoes.us.com http://www.2017nikeairmax.us http://www.polooutlet.in.net http://www.nikeoutlet.in.net http://www.red-bottoms.us.com http://www.kate-spade.us.com http://www.coachfactoryoutlet-storeonline.us.com http://www.canadagoose-jacketsoutlet.us http://www.uggoutlet-onlines.us.com http://www.coachoutlets.us.org http://www.cheapjordanshoes.us.com http://www.coachfactoryonlineoutlet.com.co http://www.uggoutletonline.name http://www.uggs-boots.us.org http://www.canadagoosesaleoutlet.us.com http://www.uggoutlets.us.org http://www.mulberry-bags.me.uk http://www.uggsoutlets.us.org http://www.nikeshoes.us.com http://www.uggoutletstore.name http://www.hermes.us.org http://www.moncleroutlets.us.org http://www.canadagoosesoutlet.ca http://www.ralph-laurenoutlet.org.uk http://www.canadagoosejacketssale.com.co http://www.airmax-2018.com http://www.canadagooseclothing.us.com mt1125