localStorage setItem vs setter (v4)

Revision 4 of this benchmark created by Wesley Hales 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
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
SET brackets small
localStorage['small']='X'
ready
SET brackets large
localStorage['large']=largeValue
ready

Revisions

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