@bunchmark/core
Advanced tools
Comparing version 1.0.0-pre-10 to 1.0.0-pre-11
{ | ||
"name": "@bunchmark/core", | ||
"version": "1.0.0-pre-10", | ||
"version": "1.0.0-pre-11", | ||
"description": "benchmarking lib", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -140,3 +140,3 @@ export { run }; | ||
for (const j in sh) { | ||
yield { kind: "task", task: runOne(sh[j]) }; | ||
yield { kind: "task", task: runOne(sh[j]), i: sh[j].i }; | ||
} | ||
@@ -203,2 +203,3 @@ } | ||
async function go() { | ||
try { | ||
/** | ||
@@ -208,36 +209,39 @@ * $typedef IteratorResult<YieldTask | YieldTick, ReturnTick> | ||
let status; | ||
do { | ||
await delay(0); | ||
try { | ||
do { | ||
status = runner.next(); | ||
if (!status.done && isTask(status)) | ||
await (status.value).task; | ||
else | ||
break; | ||
} while (true); | ||
} | ||
catch (e) { | ||
reject(e); | ||
return; | ||
} | ||
// appease TypeScript, this can't ever be null | ||
if (status == null) throw new TypeError("Unexpected null") | ||
if (!status.done) { | ||
if (!isTick(status)) | ||
throw new TypeError("Unexpected YieldResult " + JSON.stringify(status.value)); | ||
runnerOptions.onTick?.({ | ||
i: status.value.i - 1, | ||
reps: status.value.reps, | ||
entries: tasks.map(t => t.result) | ||
}); | ||
} | ||
do { | ||
await delay(0); | ||
try { | ||
do { | ||
status = runner.next(); | ||
if (!status.done && isTask(status)) await (status.value).task | ||
else break | ||
} while (true); | ||
} | ||
catch (e) { | ||
if (isTask(status)) e.TaskIndex = status.value.i | ||
reject(e); | ||
state.done = true | ||
return; | ||
} | ||
// appease TypeScript, this can't ever be null | ||
if (status == null) throw new TypeError("Unexpected null") | ||
if (!status.done) { | ||
if (!isTick(status)) | ||
throw new TypeError("Unexpected YieldResult " + JSON.stringify(status.value)); | ||
runnerOptions.onTick?.({ | ||
i: status.value.i - 1, | ||
reps: status.value.reps, | ||
entries: tasks.map(t => t.result) | ||
}); | ||
} | ||
} while (!status.done && state.run && !state.done); | ||
if (status.done || state.done) | ||
fulfill({ | ||
} while (!status.done && state.run && !state.done); | ||
if (status.done || state.done) fulfill({ | ||
i: status.value.i - 1, | ||
reps: status.value.reps, | ||
entries: tasks.map(t => t.result) | ||
}); | ||
}); | ||
} catch(e) { | ||
reject(e); | ||
state.done = true | ||
} | ||
} | ||
@@ -244,0 +248,0 @@ Promise.resolve().then(go).catch(reason => reject(reason)); |
17053
505