localStorage vs. Objects (v25)

Revision 25 of this benchmark created by women on


Description

Tests the difference between reading from localStorage as compared to reading data from an object.

Preparation HTML

<script>
  localStorage.setItem("foo", "body { background: blue; margin: 10px; padding: 10px; color: black; text-decoration: none; }");


  var FOO = {
    foo: "body { background: blue; margin: 10px; padding: 10px; color: black; text-decoration: none; }"
  };

  var value;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
本地存储中用方法取
value = localStorage.getItem("foo");
ready
从本地存取中对象取
value = localStorage["foo"];
ready
本地存取用点取
value = localStorage.foo;
ready
Object with function
 
ready
Bound LocalStorge
 
ready

Revisions

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