perf: NPC 생명주기 메모리 프로파일과 큐 정리를 추가한다

This commit is contained in:
2026-08-24 13:02:19 +00:00
parent 8ef93ecadc
commit f9cb60a50f
15 changed files with 997 additions and 2 deletions
@@ -0,0 +1,20 @@
import { describe, expect, it } from 'vitest';
import { linearRegressionSlope } from './helpers/npcLifecycleMemoryProfiler.js';
describe('NPC lifecycle memory profiler metrics', () => {
it('calculates the retained-byte slope from unevenly spaced samples', () => {
expect(
linearRegressionSlope([
{ x: 0, y: 100 },
{ x: 2, y: 140 },
{ x: 5, y: 200 },
])
).toBeCloseTo(20, 8);
});
it('returns zero when a trend cannot be established', () => {
expect(linearRegressionSlope([])).toBe(0);
expect(linearRegressionSlope([{ x: 1, y: 10 }])).toBe(0);
});
});