mirror of https://github.com/vuejs/core.git
workflow: fix inaccurate test timer in benchmark (#286)
This commit is contained in:
parent
2ed0be8020
commit
b5ed2ec9bb
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue