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 mixedArray = [1, 5, 2, 6, 15, 'str', 'foobar', 9, 65, '2'];
var numArray = [1, 8, 6, 4, 9, 2, 18, 14, 18, 7];
var strArray = ['hi', 'str', 'poke', 'spam', 'eggs', 'foo', 'bar', 'ham', 'baz', 'fake'];
var bool = false;
var badStr = 'fail';
var badNum = 3;
var getNext = (function() {
var i = 0;
return function(array, isStr) {
switch (isStr) {
case 0:
return (i < 10) ? array[i++] : i = 0, badNum;
case 1:
return (i < 10) ? array[i++] : i = 0, badStr;
case 2:
if (i < 10) return array[i++];
if (i === 10) return i++, badStr;
return i = 0, badNum;
}
};
})();
Ready to run.
Test | Ops/sec | |
---|---|---|
Array.indexOf (mixed types) |
| ready |
in operator (mixed types) |
| ready |
Array.indexOf (strings only) |
| ready |
in operator (strings only) |
| ready |
Array.indexOf (numbers only) |
| ready |
in operator (numbers only) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.