Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

speed.bench.ts

24 lines600 Bytes

1import { bench, describe } from 'vitest'
2import { runSsrRequestLoop } from '../bench-utils'
3import type { StartRequestHandler } from '../bench-utils'
4​
5const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href
6const benchmarkSeed = 0xdecafbad
7​
8const { default: handler } = (await import(
9 /* @vite-ignore */ appModuleUrl
10)) as {
11 default: StartRequestHandler
13​
14describe('ssr', () => {
15 bench(
16 'ssr request loop (react)',
17 () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),
18 {
19 warmupIterations: 100,
20 time: 10_000,
21 throws: true,
22 },
23 )
24})