@bunchmark/core
Advanced tools
Comparing version 1.0.0-pre-11 to 1.0.0-pre-12
{ | ||
"name": "@bunchmark/core", | ||
"version": "1.0.0-pre-11", | ||
"version": "1.0.0-pre-12", | ||
"description": "benchmarking lib", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -80,4 +80,3 @@ export { run }; | ||
break; | ||
} | ||
else { | ||
} else { | ||
N *= 2; | ||
@@ -107,4 +106,3 @@ } | ||
result.workspace.push(t); | ||
if (keepChrono) | ||
result.chronological.push(t); | ||
if (keepChrono) result.chronological.push(t); | ||
} | ||
@@ -131,4 +129,3 @@ | ||
} | ||
} | ||
else { | ||
} else { | ||
if (i === calibrationRuns) { | ||
@@ -143,2 +140,3 @@ // set the final iteration number for each task | ||
for (const j in sh) { | ||
console.log(Object.keys(sh[k]), sh[k].i) | ||
yield { kind: "task", task: runOne(sh[j]), i: sh[j].i }; | ||
@@ -189,7 +187,8 @@ } | ||
options.handle.pause = (mode = true) => { | ||
if (mode !== state.run) | ||
return; | ||
if (mode !== state.run) return; | ||
state.run = !mode; | ||
if (state.run) | ||
Promise.resolve().then(go).catch(reason => reject(reason)); | ||
if (state.run && !state.done) Promise.resolve().then(go).catch(reason => { | ||
state.done = true | ||
reject(reason) | ||
}); | ||
}; | ||
@@ -207,47 +206,43 @@ options.handle.stop = () => { state.done = true; }; | ||
async function go() { | ||
try { | ||
/** | ||
* $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) { | ||
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) | ||
}); | ||
} | ||
/** | ||
* $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) { | ||
state.done = true | ||
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) | ||
}); | ||
} | ||
} 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 | ||
} | ||
} 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) | ||
}); | ||
} | ||
Promise.resolve().then(go).catch(reason => reject(reason)); | ||
Promise.resolve().then(go).catch(reason => { | ||
state.done = true | ||
reject(reason) | ||
}); | ||
return result | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16838
500