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
const a = {x: 1, y: 2, z: 3, w: 4}
const b = {x: 1, y: 2, z: 3, w: 4}
const c = {x: 1, y: 2, z: 3, w: 5}
const d = {x: 6, y: 7, z: 8, w: 9}
const epsilon = 0.0001;
function distance(p1, p2)
{
const dx = p1.x - p2.x;
const dy = p1.y - p2.y;
const dz = p1.z - p2.z;
const dw = p1.w - p2.w;
return Math.sqrt(dx ** 2 + dy ** 2 + dz ** 2 + dw ** 2);
}
function approxEqualsLength(p1, p2)
{
return distance(p1, p2) < epsilon;
}
function approxEqualsAbs(p1, p2)
{
return Math.abs(p1.x - p2.x) < epsilon &&
Math.abs(p1.y - p2.y) < epsilon &&
Math.abs(p1.z - p2.z) < epsilon &&
Math.abs(p1.w - p2.w) < epsilon;
}Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Approx Equals Length Same Value | | ready |
| Approx Equals Length Similar Value | | ready |
| Approx Equals Length Different Value | | ready |
| Approx Equals Abs Same Value | | ready |
| Approx Equals Abs Similar Value | | ready |
| Approx Equals Abs Different Value | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.