localStorage vs globals (v4)

Revision 4 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.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;
for (var i = 0; i < 1000; i++) {
  CURRENT_NODE == 'DEV';
}
ready
using localStorage
var count = 0;
for (var i = 0; i < 1000; i++) {
  localStorage.currentNode == 'DEV';
}
ready

Revisions

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