perf(game-engine): 대규모 NPC 천통 시간을 계측
시나리오 2601의 880명·94도시를 DB와 Redis 없이 자동 실행하고 커맨드, 수뇌 여부, 연월별 시간을 JSON으로 기록한다.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
});
|
||||
Reference in New Issue
Block a user