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
3 pairs of tests. Just focus on the ops/sec between each pair.
const count = 10_000;
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,_:;#+*'?=)(/&%$!";
function randomString(size) {
var string = "";
for ( let i = 0; i < size; i++ ) {
string += chars[Math.floor(Math.random() * chars.length)];
}
return string;
}
var hugeArrayOfObjects = [];
for ( let i = 0; i < count; i++ ) {
hugeArrayOfObjects.push({
lon: Math.random() * 360 - 180,
lat: Math.random() * 180 - 90,
a: randomString(32),
b: randomString(16),
c: randomString(48),
});
}
var hugeArrayOfStrings = [];
for ( let i = 0; i < count; i++ ) {
const src = hugeArrayOfObjects[i];
hugeArrayOfStrings.push([src.lon, src.lat, src.a, src.b, src.c].join(";"));
}
var hugeString = hugeArrayOfStrings.join("|");
Ready to run.
Test | Ops/sec | |
---|---|---|
json hugeArrayOfStrings |
| ready |
structuredClone hugeArrayOfStrings |
| ready |
json hugeArrayOfObjects |
| ready |
structuredClone hugeArrayOfObjects |
| ready |
json string |
| ready |
structuredClone string |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.