Pārlūkot izejas kodu

workflow: fix inaccurate test timer in benchmark (#286)

Rizumu Ayaka 1 gadu atpakaļ
vecāks
revīzija
b5ed2ec9bb
2 mainītis faili ar 5 papildinājumiem un 3 dzēšanām
  1. 1 1
      benchmark/client/App.vue
  2. 4 2
      benchmark/client/profiling.ts

+ 1 - 1
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()
   }
 }
 

+ 4 - 2
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(