localStorage vs. Objects (v40)

Revision 40 of this benchmark created on


Description

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

Preparation HTML

<script>
  data = [{"id":1,"title":"Default","siteList":"","url_protocol":false,"url_subdomain":false,"url_domain":true,"url_path":false,"strUseText":"","hashAlgorithm":"md5","username":"","modifier":"","passwordLength":"8","selectedCharset":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./","passwordPrefix":"","passwordSuffix":"","whereToUseL33t":"off","l33tLevel":"0"},{"id":2,"title":"Alphanumeric","siteList":"","url_protocol":false,"url_subdomain":false,"url_domain":true,"url_path":false,"strUseText":"","hashAlgorithm":"md5","username":"","modifier":"","passwordLength":8,"selectedCharset":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789","passwordPrefix":"","passwordSuffix":"","whereToUseL33t":"off","l33tLevel":0}];

  localStorage.setItem("foo", data);
  
  var FOO = {
   foo: data
  };
  
  var value;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Reading from an object
value = FOO.foo;
ready
Reading from localStorage
value = localStorage.foo;
ready

Revisions

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