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

speed.bench.ts

22 lines599 Bytes

1import { test } 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​
14test('ssr', async ({ bench }) => {
15 await bench('ssr request loop (react)', async () =>
16 runSsrRequestLoop(handler, { seed: benchmarkSeed }),
17 ).run({
18 warmupIterations: 100,
19 time: 10_000,
20 throws: true,
21 })
22})