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
Comparing the speed of Math trig functions vs pre-computing the values into a lookup table.
Turns out trig is surprisingly fast in Firefox!
var sinTable = new Float32Array(21600);
var a;
for (var rep = 0; rep < 21600; rep++) {
sinTable[rep] = (Math.sin((2 * Math.PI) * (rep / 21600)));
}
Ready to run.
Test | Ops/sec | |
---|---|---|
1) lookup table |
| ready |
2) Math.sin |
| ready |
3) Math.cos |
| ready |
4) Math.tan |
| ready |
5) Math.asin |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.