]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
workflow: fix inaccurate test timer in benchmark (#286)
authorRizumu Ayaka <rizumu@ayaka.moe>
Mon, 11 Nov 2024 09:01:44 +0000 (17:01 +0800)
committerGitHub <noreply@github.com>
Mon, 11 Nov 2024 09:01:44 +0000 (17:01 +0800)
benchmark/client/App.vue
benchmark/client/profiling.ts

index 8c2d9a3b33d45d7db68d9a31b4b043d0c41f9eae..350cd7df1016752083e0820bbf249e3dc50d1ba5 100644 (file)
@@ -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()
   }
 }
 
index 2269e5ef9beb1174353416503fd7255d45b62d2a..f4b5eaeb93d651c909d40319fa38788de99dddd7 100644 (file)
@@ -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(