Skip to content

Commit

Permalink
bench: use correct bench for @vue/compiler-sfc
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix-ru committed Nov 21, 2023
1 parent a6d4a93 commit d868259
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ Yes, it is incredibly fast. In fact, below is a benchmark run for a [test compon

```
@vue/compiler-sfc:
1 644 ops/s, ±0.78% | slowest, 97.2% slower
954 ops/s, ±1.15% | slowest, 98.42% slower
@fervid/napi sync:
6 240 ops/s, ±0.44% | 89.36% slower
6 464 ops/s, ±0.08% | 89.29% slower
@fervid/napi async (4 threads):
12 856 ops/s, ±1.53% | 78.08% slower
11 624 ops/s, ±2.12% | 80.73% slower
@fervid/napi async CPUS (23 threads):
58 650 ops/s, ±1.25% | fastest
60 329 ops/s, ±0.67% | fastest
```

<!--
Expand Down
10 changes: 5 additions & 5 deletions crates/fervid/benches/fixtures/input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
<br v-show="false">
<another-element v-for="i in 3" :key="i" v-text="foo + bar"></another-element>

<template v-for="([item1, item2], index) in list">
<template v-for="([item1, item2], index) in list" :key="index">
hey
<span :key="index">{{ item1 }}{{ index }}</span>
<div :key="index" class="both regular and bound" :class="[item2, index]"></div>
<div :key="index" class="just regular class"></div>
<div :key="index" :class="[member.expr, globalIdent, item2, index]"></div>
<span>{{ item1 }}{{ index }}</span>
<div class="both regular and bound" :class="[item2, index]"></div>
<div class="just regular class"></div>
<div :class="[member.expr, globalIdent, item2, index]"></div>
</template>

<template v-if="false">
Expand Down
12 changes: 7 additions & 5 deletions crates/fervid_napi/benchmark/bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import kleur from 'kleur'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { cpus } from 'node:os'
import { compileTemplate } from '@vue/compiler-sfc'
import { compileScript, parse } from '@vue/compiler-sfc'

import { compileAsync, compileSync } from '../index'

Expand All @@ -23,10 +23,12 @@ async function run() {
'compile sfc',

b.add('@vue/compiler-sfc', () => {
compileTemplate({
filename: 'input.vue',
source: input,
id: '',
const descriptor = parse(input, { filename: 'input.vue' })
compileScript(descriptor.descriptor, {
id: 'abc',
isProd: true,
inlineTemplate: true,
defineModel: true
})
}),

Expand Down

0 comments on commit d868259

Please sign in to comment.