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
Test speed of Array.isArray added in 1.85
var arrayShort = [1, 2, 3];
var arrayLong = new Array(1000);
var bool = false;
var element = document.createElement('span');
var string = "random string";
var text = document.createTextNode('text node');
var toString = Object.prototype.toString;
var isArray = function(val) {
if (typeof val === 'boolean') return false;
return val instanceof Array;
};
var isArray2 = function(val) {
return val.constructor === Array;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Array.isArray arrayShort |
| ready |
Array.isArray arrayLong |
| ready |
Array.isArray bool |
| ready |
Array.isArray element |
| ready |
Array.isArray string |
| ready |
Array.isArray text |
| ready |
instanceof arrayShort |
| ready |
instanceof arrayLong |
| ready |
instanceof bool |
| ready |
instanceof element |
| ready |
instanceof string |
| ready |
instanceof text |
| ready |
toString arrayShort |
| ready |
toString arrayLong |
| ready |
toString bool |
| ready |
toString element |
| ready |
toString string |
| ready |
toString text |
| ready |
isArray(arrayShort); |
| ready |
isArray(arrayLong); |
| ready |
isArray(bool); |
| ready |
isArray(element); |
| ready |
isArray(string); |
| ready |
isArray(text); |
| ready |
isArray2(arrayShort); |
| ready |
isArray2(arrayLong); |
| ready |
isArray2(bool); |
| ready |
isArray2(element); |
| ready |
isArray2(string); |
| ready |
isArray2(text); |
| ready |
Coffeescript style(arrayShort) |
| ready |
Coffeescript style(arrayLong) |
| ready |
Coffeescript style(bool) |
| ready |
Coffeescript style(element) |
| ready |
Coffeescript style(string) |
| ready |
Coffeescript style(text) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.