jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
The goal is to figure out if it's faster to serialize a simple object to json or use two keys in the storage.
We assume that we know exactly how the object has to be (de)serialized.
For that we serialize and unserialize the same object into localStorage. Once using two separated key and in the other case using JSON.
var toSerialize = {
foo: 'bar',
bar: 'foo'
};
var unSerialized;
localStorage.clear();
delete unSerialized;
Ready to run.
Test | Ops/sec | |
---|---|---|
localStorage using two keys |
| ready |
localStorage with JSON |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.