Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
test localstorage
(version: 0)
Comparing performance of:
test 1 vs test 2
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var reader_settings = { "readerMenu": { "readStyle": 1, "viewStyle": 1, "fitStyle": 3, "stretchStyle": 2, "headerStyle": 0, "progressBarDirection": 1, "doAutoAdvance": true, "limitMaxWidth": false, "limitMaxHeight": false, "maxWidth": -1, "maxHeight": -1, "keys": { "toggleMenu": [ "KeyM", null ], "pageForward": [ "ArrowRight", "Numpad6" ], "pageBackward": [ "ArrowLeft", "Numpad4" ], "chapterForward": [ "Period", null ], "chapterBackward": [ "Comma", null ], "immersiveMode": [ "KeyF", null ], "offsetSpread": [ "KeyO", null ] }, "lock": { "width": true, "height": true, "contain": true, "none": true }, "lockOffset": 0, "longStripMargin": 1, "offsetDoubles": {}, "hasImmersiveBefore": false, "keyEvents": true, "backgroundColor": "transparent" }, "drawer": {}, "userPreferences": { "filteredLanguages": [ "en" ], "initialLoadCount": 50, "subsequentLoadCount": 50, "showSafe": true, "showErotic": true, "showSuggestive": true, "showHentai": false, "isDark": false } }
Tests:
test 1
localStorage.setItem("md", JSON.stringify(reader_settings));
test 2
localStorage.setItem("md", JSON.stringify(reader_settings));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
test 1
test 2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Browser/OS:
Chrome 145 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
test 1
254531.1 Ops/sec
test 2
257364.9 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Measuring the performance of JavaScript microbenchmarks can be a complex task, and the provided benchmark definition json is just one example. **What is tested:** The provided benchmark definition measures the time it takes to set an item in the LocalStorage API using the `setItem` method. The benchmark tests two different approaches: 1. **Setting the item**: The first approach measures the time it takes to set a single item in LocalStorage, specifically `"md"` with the value of the `reader_settings` object stringified using `JSON.stringify`. 2. **Setting multiple items**: The second approach measures the time it takes to set multiple items in LocalStorage using an array of objects. **Options compared:** Two options are being compared: 1. **Direct setting**: Setting a single item directly in LocalStorage. 2. **Batching**: Batching multiple items together and then executing them as a single operation. **Pros and cons of each approach:** * **Direct setting**: + Pros: - Simple and straightforward implementation. - Can be faster for small numbers of items due to reduced overhead. + Cons: - May lead to slower performance when dealing with large numbers of items, as the browser needs to execute multiple operations sequentially. * **Batching**: + Pros: - Can improve performance by reducing the number of operations executed by the browser. - Can be more efficient for large numbers of items, but may introduce additional overhead due to batch processing. + Cons: - Requires careful implementation to ensure that batching is implemented correctly and doesn't introduce unnecessary overhead. **Other considerations:** * **Browser behavior**: The behavior of the browser when dealing with LocalStorage can vary across different versions and platforms. It's essential to test the benchmark on multiple browsers and platforms to get accurate results. * **Network conditions**: Network latency and connectivity can impact the performance of LocalStorage operations. It's crucial to consider network conditions when running benchmarks. **Library usage:** The `reader_settings` object is being passed as a stringified JSON object to LocalStorage using `JSON.stringify`. The purpose of this library is to provide a predefined set of settings for the reader application, allowing the user to customize their reading experience. **Special JS feature or syntax:** There are no special JavaScript features or syntax used in this benchmark. However, it's worth noting that some browsers may optimize LocalStorage operations using caching or other techniques, which can impact performance. **Alternatives:** Other alternatives for measuring JavaScript microbenchmarks include: * **Web Workers**: Using Web Workers to execute benchmarks concurrently on multiple CPU cores. * **Benchmarking libraries**: Utilizing specialized benchmarking libraries like Benchmark.js, Microbenchmark, or JSPerf to simplify the benchmarking process and provide more accurate results. * **Simulated environments**: Creating simulated environments using tools like V8 Inspector or Chrome DevTools' profiling tools to test performance in a controlled setting. Keep in mind that each alternative has its own strengths and weaknesses, and the choice of which one to use depends on the specific requirements of your benchmarking needs.
Related benchmarks:
attribute access
scrollbind
data vs class
mybencmark115000
Comments
Confirm delete:
Do you really want to delete benchmark?