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
Let's compare apples to apples.
We will use the for loop itself as the arithmetic mechanism.
Need to be sure types are kept consistent.
var
int_0 = 0 | 0,
max = 10000,
maxInt = max | 0,
maxFloat = 1
incrementInt = 1 | 0,
incrementFloat = 1/max;
var resultInt = int_0, resultFloat = 0;
resultInt = int_0;
resultFloat = 0;
Ready to run.
Test | Ops/sec | |
---|---|---|
int add |
| ready |
float add (fraction) |
| ready |
float add (fraction constant) |
| ready |
int add (no | 0) |
| ready |
float add (integer) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.