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 mapKeyValue = new Map();
var mapStringKeyValue = new Map();
var objectKeyValue = {};
var n = 100000;
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 20; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
for(var i=0;i<n;i++) {
var value = makeid();
mapKeyValue.set(i, value);
mapStringKeyValue.set(i+"",value);
objectKeyValue[i+""] = value;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
First Object from Map by Integer Key |
| ready |
First Object from Map by String key |
| ready |
First Object from Object by String Key |
| ready |
Middle Object from Map by Integer Key |
| ready |
Middle Object from Map by String Key |
| ready |
Middle Object from Object by String Key |
| ready |
Last Object from Map by Integer Key |
| ready |
Last Object from Map by String Key |
| ready |
Last Object from Object by String Key |
| ready |
Non-existent Object from Map by Integer Value |
| ready |
Non-existent Object from Map by String |
| ready |
Non-existent Object from Object by String Key |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.