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
Testing performance of the random function used in http://fab.cba.mit.edu/classes/863.14/people/index.html to select a random student vs. standard javascript Math.random()
function get_time() {
if (window.performance != undefined){
if (window.performance.now != undefined) {
return performance.now();
}
}
return Date.now();
}
var t0 = get_time()
function neil_random(max) {
var dt = (get_time() - t0)/1000.0;
return Math.floor(max * (dt - Math.floor(dt)));
}
function world_random(max) {
return Math.floor(Math.random() * max);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Neil |
| ready |
World |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.