Files
core2026/app/game-engine/scripts/profile-npc-unification-timing.mjs
T
Hide_D 20c04283fb perf(game-engine): 대규모 NPC 천통 시간을 계측
시나리오 2601의 880명·94도시를 DB와 Redis 없이 자동 실행하고 커맨드, 수뇌 여부, 연월별 시간을 JSON으로 기록한다.
2026-08-15 19:36:38 +00:00

43 lines
1.1 KiB
JavaScript

import { spawn } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const vitestPath = path.join(packageRoot, 'node_modules', 'vitest', 'vitest.mjs');
const child = spawn(
process.execPath,
[
'--expose-gc',
vitestPath,
'run',
'--config',
'vitest.config.ts',
'--pool=threads',
'--maxWorkers=1',
'test/npcScenarioUnificationBenchmark.test.ts',
],
{
cwd: packageRoot,
env: {
...process.env,
NPC_UNIFICATION_BENCHMARK: '1',
},
stdio: 'inherit',
}
);
child.once('error', (error) => {
console.error('[npc-unification-timing] failed to start benchmark', error);
process.exitCode = 1;
});
child.once('exit', (code, signal) => {
if (signal) {
console.error(`[npc-unification-timing] benchmark terminated by ${signal}`);
process.exitCode = 1;
return;
}
process.exitCode = code ?? 1;
});