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
A friend of mine was pretty excited to learn that there are possible speed increases associated with shifting bits over the multiplication operator, or by using multiplication over the division operator. However, I wonder if a good compiler or interpreter wouldn't make these optimization choices for you! Let's find out with JS!
This test is more effective than earlier versions of this test. On the other versions, the function calls and calls to console.log have significantly more overhead than simply doing the math. However, the values must be stored, as any reasonable smart optimizer will see that code not stored is irrelevant and therefore won't run it.
Ready to run.
Test | Ops/sec | |
---|---|---|
Multiplication (int) |
| ready |
Bit-Shifting (left) |
| ready |
Division Operator |
| ready |
Division through Multiplying by a Float |
| ready |
Division through bit-shifting right. |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.