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 code = [];
for (var i = 0; i < 10000; i++) {
code.push(`o[${Math.random()}] = ${Math.random()};`);
}
var add_properties = new Function("var o = {}; "+code.join(" ") + " return o; ");
var object_literal = new Function("return " + JSON.stringify(full));
var full = add_properties();
var assigned_properties = new Function("var o = {}; Object.assign(o, " + JSON.stringify(full) + "); return o;");
var spread_properties = function() { var o = { ...full }; return o; };
Ready to run.
Test | Ops/sec | |
---|---|---|
Adding Properties |
| ready |
Declared Object Literal |
| ready |
Object.assign Properties into Object |
| ready |
{ ...other_obj } |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.