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
How fast is the table lookup doing log base 2?
function log(a) {
return Math.log(a) / Math.log(2)
};
var table = [0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9];
function lookup(a) {
return table[(a & -a) * 0x077CB531 >>> 27]
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Log |
| ready |
Lookup |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.