localStorage read/write test (v3)

Revision 3 of this benchmark created by John-David Dalton on


Setup

var data_512 = new Array(512 * 1024 + 1).join('x'); // 512k
  var data_10 = new Array(10 * 1024 + 1).join('x'); // 10k
  var data_1 = new Array(1025).join('x'); // 1k
  
  var i = 0;
  var sto = window.localStorage;
  
  sto.clear();
  sto.setItem("512k", data_512);
  sto.setItem("10k", data_10);
  sto.setItem("1k", data_1);

Test runner

Ready to run.

Testing in
TestOps/sec
localStorage (1k)
sto.setItem('1k', data_1 + i++);
var value = sto.getItem('1k');
ready
localStorage (10k)
sto.setItem('10k', data_10 + i++);
var value = sto.getItem('10k');
ready
localStorage (512k)
sto.setItem('512k', data_512 + i++);
var value = sto.getItem('512k');
ready

Revisions

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

  • Revision 1: published by Jens Arps on
  • Revision 3: published by John-David Dalton on