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
var obj = {
Key1: "Val1",
Key2: 42,
Key3: "Val3",
Key4: "Val4"
};
function json_to_hstore_map (json) {
if (typeof json == 'string') json = JSON.parse(json);
var result = Object.keys(json).map(function(key) {
var value = json[key];
value = value === null ? 'NULL' : JSON.stringify(value.toString());
return '"' + key + '" => ' + value;
}).join(', ');
return result;
}
function json_to_hstore_for (json) {
if (typeof json == 'string') json = JSON.parse(json);
var hstore = [];
for (var key in json) {
var value = json[key];
value = value === null ? 'NULL' : JSON.stringify(value.toString());
hstore.push('"' + key + '" => ' + value);
}
return hstore.join(', ');
}
if (json_to_hstore_map(obj) != json_to_hstore_for(obj)) {
throw "Tests not equal";
}
Ready to run.
Test | Ops/sec | |
---|---|---|
map |
| ready |
for |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.