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
Compare all the various ways to floor a number:
Math.floor(num)
- tried and true~~num
- double bitwise NOTnum|0
- bitwise OR with zeronum<<0
- left bitwise shift, but not really shiftingnum>>0
- right bitwise shift, but not really shiftingnum>>>0
- unsigned right bitwise shift, but not really shiftingnum&0xFFFFFFFF
- bitwise AND with all-bits-onnum^0^0
- double bitwise XOR with zeronum^0
- simple bitwise XOR with zeronum&num
- bitwise AND with selfvar num = 26.9;
Ready to run.
Test | Ops/sec | |
---|---|---|
Math.floor |
| ready |
Double bitwise NOT |
| ready |
Bitwise OR with 0 |
| ready |
Left shift with 0 |
| ready |
Right shift with 0 |
| ready |
Unsigned right shift with 0 |
| ready |
Bitwise AND with all-bits-on |
| ready |
Double bitwise XOR with 0 |
| ready |
Simple bitwise XOR with 0 |
| ready |
Bitwise AND with self |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.