blob: e4340400189ac173fc73aeb08e1d1eb83c56bd30 [file] [log] [blame]
//@ skip if $model == "Apple Watch Series 3" # added by mark-jsc-stress-test.py
function test(bias) {
let set = new Set;
let counter = 0;
for (let i = 0; i < 50000; i++) {
++counter;
if (!set.size || Math.random() > bias) {
let key = counter;
set.add(key);
} else {
let keyToRemove = set[Symbol.iterator]().next().value;
set.delete(keyToRemove);
}
}
}
let start = Date.now();
test(0.45);
test(0.60);
const verbose = false;
if (verbose)
print(Date.now() - start);