Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
2nd localStorage and sessionStorage Speedtest
(version: 0)
runs each test 210x
Comparing performance of:
Control vs localStorage vs sessionStorage
Created:
3 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
localStorage.setItem('foo', 'bar') sessionStorage.setItem('foo', 'bar')
Tests:
Control
var FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar'; FOO = 'bar';
localStorage
var FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo'); FOO = localStorage.getItem('foo');
sessionStorage
var FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo'); FOO = sessionStorage.getItem('foo');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Control
localStorage
sessionStorage
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
**Benchmark Overview** The provided benchmark measures the speed of accessing and manipulating local storage (localStorage) and session storage (sessionStorage) in a JavaScript application. **What is being tested?** Three test cases are compared: 1. **Control**: A simple assignment statement `var FOO = 'bar'; FOO = 'bar';` repeated 10 times. 2. **localStorage**: Accessing the value of a key (`foo`) stored in localStorage and assigning it back to a variable, repeated 10 times. 3. **sessionStorage**: Similar to the previous test case but using sessionStorage instead. **Options compared** Two options are being compared: * Local storage (localStorage) * Session storage (sessionStorage) **Pros and Cons of each approach** 1. **Local Storage (localStorage)** * Pros: + Persistent data storage between page reloads + Can be accessed from multiple pages * Cons: + Data is stored on the client-side, which means it can be lost if the user clears their browser's cache or cookies 2. **Session Storage (sessionStorage)** * Pros: + Temporary data storage that expires when the session ends + Less prone to data corruption and security issues compared to localStorage * Cons: + Data is lost when the page reloads or the user closes their browser **Library usage** None of the test cases use any external libraries. **Special JS feature/syntax** None are mentioned in the provided benchmark definition. **Other considerations** The benchmark measures the speed of accessing and manipulating local storage, which can be affected by various factors such as: * The amount of data stored * The frequency of access * The device's hardware capabilities **Alternatives to this benchmark** Other benchmarks that could be used to measure performance in a similar context might include: * Accessing and manipulating DOM elements * Performing calculations or string operations * Using other types of storage like IndexedDB
Related benchmarks:
localStorage and sessionStorage Speedtest
localStorage vs sessionStorage vs Reading a Hardcoded Array Speedtest
Just localStorage vs sessionStorage Speedtest
In-memory, localStorage and sessionStorage Speedtest
Comments
Confirm delete:
Do you really want to delete benchmark?