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>
Array.prototype.uniqueCoffee = function() {
var i, j, l, _results;
l = this.length;
_results = [];
for (i = 0; 0 <= l ? i <= l : i >= l; 0 <= l ? i++ : i--) {
for (j = 0; 0 <= l ? j <= l : j >= l; 0 <= l ? j++ : j--) {
if (this.i === this.j) {
j = ++i;
}
}
_results.push(this[i]);
}
return _results;
};
Array.prototype.unique = function() {
var a = [];
var l = this.length;
for(var i=0; i<l; i++) {
for(var j=i+1; j<l; j++) {
// If this[i] is found later in the array
if (this[i] === this[j])
j = ++i;
}
a.push(this[i]);
}
return a;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
coffee |
| ready |
normal |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.