Open History to see the last commit
1import { fileURLToPath } from 'node:url'
2import { isMemoryInstrumented } from './turn'
3β
4/** Worker settings for the CodSpeed memory instrument. */
5export function memoryExecArgv() {
6 if (!isMemoryInstrumented()) {
7 return []
8 }
9β
10 // Limit variation from GC scheduling and bytecode reclamation; keep a
11 // fixed initial old-generation budget.
12 return [
13 '--no-flush-bytecode',
14 '--no-minor-gc-task',
15 '--no-incremental-marking',
16 '--initial-old-space-size=512',
17 ]
18}
19β
20export function memoryConfig(side: 'client' | 'server') {
21 const execArgv = memoryExecArgv()
22 return {
23 execArgv,
24 setupFiles:
25 side === 'client' || isMemoryInstrumented()
26 ? [fileURLToPath(new URL(`./${side}/vitest.setup.ts`, import.meta.url))]
27 : [],
28 }
29}