localStorage getItem / setItem vs getter / setter (v5)

Revision 5 of this benchmark created on


Preparation HTML

<script>
  var g = localStorage.getItem;
  var s = localStorage.setItem;
  largeValue = 'X';
  for(var i=0; i<20; ++i) {value += value;}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
getItem() SMALL
g('small')
ready
getItem() LARGE
g('large')
ready
GET localStorage.small
localStorage.small
ready
GET localStorage.large
localStorage.large
ready
setItem() SMALL
s('small', 'X')
ready
setItem() LARGE
s('large', largeValue)
ready
SET localStorage.small
localStorage.small = 'X'
ready
SET localStorage.large
localStorage.large = largeValue
ready

Revisions

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