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 chans = 100;
let msgs = 100 * chans;
let channels = Array(chans).fill().map(() => new MessageChannel());
let senders = channels.map(mc => mc.port1);
let responders = channels.map(mc => mc.port2);
// pre-create promises with external resolvers
let resolver = Array(msgs).fill();
let promises = Array(msgs).fill().map((_, i) => new Promise(r => resolver[i] = r));
// echo from other end
responders.forEach(p => p.onmessage = ({data}) => p.postMessage({ id: data.id }));
// register promise resolvers AoT
senders.forEach(p => p.onmessage = ({data}) => resolver[data.id]());
Ready to run.
Test | Ops/sec | |
---|---|---|
All Messages in one Channel |
| ready |
Spread Messages over Channels |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.