localStorage getItem / setItem vs getter / setter (v3)

Revision 3 of this benchmark created by tav on


Preparation HTML

<script>
  largeValue = 'X';
  for(var i=0; i<20; ++i) {largeValue += largeValue;}
</script>

Test runner

Ready to run.

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

Revisions

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