Skip to content

Commit b5ed2ec

Browse files
authored
workflow: fix inaccurate test timer in benchmark (#286)
1 parent 2ed0be8 commit b5ed2ec

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

benchmark/client/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ const swapRows = wrap('swap', () => {
7272
async function bench() {
7373
for (let i = 0; i < 30; i++) {
7474
rows.value = []
75-
await defer()
7675
await runLots()
76+
await defer()
7777
}
7878
}
7979

benchmark/client/profiling.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
/* eslint-disable no-restricted-syntax */
33
/* eslint-disable no-restricted-globals */
44

5+
import { nextTick } from '@vue/vapor'
6+
57
declare namespace globalThis {
68
let doProfile: boolean
79
let reactivity: boolean
@@ -29,13 +31,13 @@ export function wrap(
2931
document.body.classList.remove('done')
3032

3133
const { doProfile } = globalThis
32-
await defer()
34+
await nextTick()
3335

3436
doProfile && console.profile(id)
3537
const start = performance.now()
3638
fn(...args)
3739

38-
await defer()
40+
await nextTick()
3941
let time: number
4042
if (globalThis.reactivity) {
4143
time = performance.measure(

0 commit comments

Comments
 (0)