From: Rizumu Ayaka Date: Mon, 11 Nov 2024 09:01:44 +0000 (+0800) Subject: workflow: fix inaccurate test timer in benchmark (#286) X-Git-Tag: v3.6.0-alpha.1~16^2~298 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5ed2ec9bb570b2f2ed11906b53285e9a54da8c4;p=thirdparty%2Fvuejs%2Fcore.git workflow: fix inaccurate test timer in benchmark (#286) --- diff --git a/benchmark/client/App.vue b/benchmark/client/App.vue index 8c2d9a3b33..350cd7df10 100644 --- a/benchmark/client/App.vue +++ b/benchmark/client/App.vue @@ -72,8 +72,8 @@ const swapRows = wrap('swap', () => { async function bench() { for (let i = 0; i < 30; i++) { rows.value = [] - await defer() await runLots() + await defer() } } diff --git a/benchmark/client/profiling.ts b/benchmark/client/profiling.ts index 2269e5ef9b..f4b5eaeb93 100644 --- a/benchmark/client/profiling.ts +++ b/benchmark/client/profiling.ts @@ -2,6 +2,8 @@ /* eslint-disable no-restricted-syntax */ /* eslint-disable no-restricted-globals */ +import { nextTick } from '@vue/vapor' + declare namespace globalThis { let doProfile: boolean let reactivity: boolean @@ -29,13 +31,13 @@ export function wrap( document.body.classList.remove('done') const { doProfile } = globalThis - await defer() + await nextTick() doProfile && console.profile(id) const start = performance.now() fn(...args) - await defer() + await nextTick() let time: number if (globalThis.reactivity) { time = performance.measure(