localStorage overhead
JavaScript performance comparison
Info
This test case shows the amount of overhead, if any, incurred when accessing data from localStorage directly compared to assigning the localStorage data to a variable and accessing the variable, as well as getting the value from a pre-populated select element.
Preparation code
<select id="test">
<option>A</option>
<option selected="selected">B</option>
<option>C</option>
</select>
<input id="output" />
<script>
localStorage['answer'] = 'B';
var oSel = document.getElementById('test'),
oOut = document.getElementById('output'),
sAns = localStorage['answer'];
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
localStorage |
|
pending… |
variable |
|
pending… |
select |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments