localStorage vs globals (v8)

Revision 8 of this benchmark created on


Description

Just a test to check performance of global storage vs global variables

Preparation HTML

<script>
  var CURRENT_NODE = 'DEV';
  localStorage.setItem('currentNode', 'DEV');
</script>
<script>
  function currentNode() {
    return localStorage.getItem('currentNode');
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
using global
var count = 0;
if (CURRENT_NODE == 'DEV') {
   count++;
}
  
ready
using localStorage
var count = 0;
if (localStorage.getItem('currentNode') == 'DEV') {
    count++;
  }
 
ready

Revisions

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