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 SIZE = 1000000; // Define the size of the dataset
const SEARCH_VALUE = "target_value";
// Generate test data
const array = Array.from({ length: SIZE }, (_, i) => "value_" + i);
array[SIZE - 1] = SEARCH_VALUE; // Ensure the value is in the array
const VALUES_TO_SEARCH = [SEARCH_VALUE, 'value_100000', 'value_34234', 'foo', 'bar']
let object = {};
for (const value of array) {
object[value] = true;
}
let set = new Set(array);
let map = new Map();
for (const value of array) {
map.set(value, true);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
array |
| ready |
map (has) |
| ready |
set |
| ready |
object |
| ready |
map (get) |
| ready |
map (get + cast to boolean) |
| ready |
object (has own property) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.