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
<script>
var testPositions = [
0, 1000, -1000, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, -1, 10, -10, -1, -10, 10, -10, 100, -10, 1235, 253, 235, 246, 26346, 2364, 744, 5368658, 45773, -689, 8, -68, ];
function normalGetBoundary(positions) {
var boundary = {
xmin: Number.MAX_VALUE,
ymin: Number.MAX_VALUE,
zmin: Number.MAX_VALUE,
xmax: Number.MIN_VALUE,
ymax: Number.MIN_VALUE,
zmax: Number.MIN_VALUE
};
var x, y, z;
for (var i = 0, len = positions.length - 3; i < len; i += 3) {
x = positions[i];
y = positions[i + 1];
z = positions[i + 2];
if (x < boundary.xmin) {
boundary.xmin = x;
}
if (y < boundary.ymin) {
boundary.ymin = y;
}
if (z < boundary.zmin) {
boundary.zmin = z;
}
if (x > boundary.xmax) {
boundary.xmax = x;
}
if (y > boundary.ymax) {
boundary.ymax = y;
}
if (z > boundary.zmax) {
boundary.zmax = z;
}
}
return boundary;
};
function fastGetBoundary(positions) {
var boundary = {
xmin: positions[0],
ymin: positions[1],
zmin: positions[2],
xmax: positions[0],
ymax: positions[1],
zmax: positions[2]
};
var x, y, z;
for (var i = 3, len = positions.length - 3; i < len; i += 3) {
x = positions[i];
y = positions[i + 1];
z = positions[i + 2];
if (x < boundary.xmin) {
boundary.xmin = x;
} else if (x > boundary.xmax) {
boundary.xmax = x;
}
if (y < boundary.ymin) {
boundary.ymin = y;
} else if (y > boundary.ymax) {
boundary.ymax = y;
}
if (z < boundary.zmin) {
boundary.zmin = z;
} else if (z > boundary.zmax) {
boundary.zmax = z;
}
}
return boundary;
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
normal |
| ready |
fast |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.