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.arrayCountFormat = function () {
var compressed = []
var copy = this.slice(0)
for (var i = 0; i < this.length; i++) {
var myCount = 0
for (var w = 0; w < copy.length; w++) {
if (this[i] == copy[w]) {
myCount++
delete copy[w]
}
}
if (myCount > 0) {
var a = new Object()
a.value = this[i]
a.count = myCount
compressed.push(a)
}
}
return compressed
}
Array.prototype.countValues = function () {
var countedValues = {};
for (var i = 0; i < this.length; i++) {
countedValues[this[i]] = (countedValues[this[i]] ?? 0) + 1;
}
return countedValues;
}
let input = ["abc", "def", "ghi", "jack", "abc", "lala", "def", "waa", "lala", "jack", "etc"];
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
1 |
| ready |
2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.