diff --git a/playground/index.html b/playground/index.html index 6537985..88091c7 100644 --- a/playground/index.html +++ b/playground/index.html @@ -35,6 +35,7 @@
main-thread-scheduling:
@@ -44,12 +45,14 @@
scheduler.postTask():
others:
diff --git a/playground/playground.ts b/playground/playground.ts
index 927715f..fa6f747 100644
--- a/playground/playground.ts
+++ b/playground/playground.ts
@@ -49,17 +49,16 @@ document.querySelector('#queue-task')!.addEventListener('click', () => {
})
async function run(strategy: SchedulingStrategy, time: number = 1000) {
- const start = Date.now()
- while (Date.now() - start < time) {
+ const start = performance.now()
+ while (performance.now() - start < time) {
if (isTimeToYield(strategy)) {
await yieldOrContinue(strategy)
}
simulateWork()
}
- performance.measure(strategy, {
+ performance.measure(`${strategy} (${Math.round(time / 1000)}s)`, {
start: start,
- end: Date.now(),
- detail: 'awesome',
+ end: performance.now(),
})
}