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 k, value, _i, _len, _results;
k = 0;
_results = [];
for (_i = 0, _len = this.length; _i < _len; _i++) {
value = this[_i];
if (!~this.indexOf(value, ++k)) {
_results.push(value);
}
}
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 version |
| ready |
plain js |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.