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
Was curious which of 2 cases was fastest. Seems it depends on the browser :) In general, data array would be an object of your making, and you would modify its prototype.toString();
<script>
var random_objects = (function(n) {
var objs = [];
while (n--)
objs[n] = {
name: String.fromCharCode(Math.random() * 65000),
value: Math.random()
};
return objs;
})(1000);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Modifying toString() on object - return name |
| ready |
Pass in function to sort() |
| ready |
Pass in function to sort() #2 |
| ready |
Pass in function to sort() #3 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.