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
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
<script>
var small = [1, 2, 3];
var medium = Array(101).join('x').split('');
var large = Array(1001).join('x').split('');
Array.prototype.shuffle1 = function() {
return this.sortBy(Math.random);
};
Array.prototype.shuffle2 = function() {
var i, tmp, object = this.slice(0),
length = object.length;
while (length--) {
i = (Math.random() * length | 0) + 1;
tmp = object[i]; /* tmp var is faster than array trick */
object[i] = object[length]
object[length] = tmp;
}
return object;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Shuffle (Fuchs) |
| ready |
Suffle (Fisher-Yates) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.