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
Is it faster to check for an item before adding it to as set, or just add it (and it will be ignored by the set because it is already in in)
const testSet100 = new Set();
for (var i=0; i<100; i++) {
testSet100.add(i);
}
const testSet1000 = new Set();
for (var i=0; i<1000; i++) {
testSet1000.add(i);
}
Ready to run.
| Test | Ops/sec | |
|---|---|---|
| Add without check (100) | | ready |
| Add with check (100) | | ready |
| Add without check (1000) | | ready |
| Add with check (1000) | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.