localStorage getItem / setItem vs getter / setter (v8)

Revision 8 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
getItem() SMALL
localStorage.getItem('small')
ready
getItem() LARGE
localStorage.getItem('large')
ready
GET localStorage.small
localStorage.small
ready
GET localStorage.large
localStorage.large
ready
setItem() SMALL
localStorage.setItem('small', 'X')
ready
setItem() LARGE
localStorage.setItem('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.