Double localStorage fetch

Benchmark created on


Setup

var _key = "test";
    localStorage.setItem(_key, '{"greeting": "Hello"}');

Test runner

Ready to run.

Testing in
TestOps/sec
Double fetch
var  a = localStorage.getItem(_key) ? JSON.parse(localStorage.getItem(_key)) : null;
ready
Single fetch
var  a = localStorage.getItem(_key);
if (a) JSON.parse(a);
ready

Revisions

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