test(scale): 기능 규모 기준선에 측정한 커밋을 남기고 다시 잰다 (0929/11-05)
문제: config/scale/feature-shape-growth.json에 측정 시각만 있고 어느
코드를 쟀는지가 없다. 기준선이 지금 코드와 맞는지, 다음 측정과 비교할 수
있는지 알 수 없다. 실제로 기준선은 2026-09-27 측정이고, 그 뒤 15-01이
초기 청크 구조를 바꿨다(ceilings.json도 "baseline predates 15-01"이라고
적고 있었다). 기준선 0개 초기 JS 200,001 B, 기능당 2,907 B는 지금 코드와
다르다.
고른 방법:
- 측정 스크립트가 시작할 때 `git rev-parse HEAD`와 추적 파일 변경 목록
(`git status --porcelain --untracked-files=no`)을 읽어 결과의
`source: { commit, modifiedPaths }`에 싣는다. 변경 목록이 비면 커밋만으로
재현된다는 뜻이다. 측정 중 트리가 바뀔 수 있어 시작할 때 읽는다.
- 기준선을 현재 코드로 다시 잰다(--sizes=0,25,100 --repeats=2 --write).
- ceilings.json의 수치를 새 기준선에 맞춘다. 초기 JS 여유는 리뷰 개선안대로
"예산 − 기준선 ÷ 기능당 증가"로 적는다(2,291 B ÷ 약 610 B ≈ 3개).
- 단위 테스트가 기준선에 40자 commit과 modifiedPaths 배열이 있는지 본다.
버린 대안:
- 기준선 커밋이 현재 이력의 조상인지 테스트로 확인: 이력 없이 3-way로
이식하는 다운스트림(tech-log)에서는 템플릿 커밋이 없어 항상 실패한다.
- dirty 트리면 --write를 거절: 이 커밋처럼 측정 스크립트와 기준선을 한
커밋에 넣을 수 없게 된다. 대신 변경 경로를 그대로 기록한다.
위험·한계:
- 기록된 커밋은 2be973a(이 브랜치의 직전 커밋)이고 modifiedPaths는 측정
스크립트와 그 테스트 2개다. 측정 대상(src, vite 설정)은 그 커밋과 같다.
이 브랜치를 rebase하면 기록된 SHA가 이력에서 사라진다. 그때는 다시 재야
한다.
- 시간 값은 호스트 부하(loadavg 27~29)에 따라 흔들린다. 바이트와
instantiation 수만 비교 대상이다.
- 15-01 커밋 본문의 202,361 B와 이번 0개 측정 202,509 B는 148 B 다르다.
원인은 확인하지 않았다. ceilings.json은 기준선 수치 하나로 통일했다.
검증:
- RED: node scripts/run-vitest.ts run tests/unit/feature-shape-growth.test.ts
-t 'commits a baseline' — "expected undefined to deeply equal { commit:
StringMatching…" 실패.
- 측정(flock): 0개 202,509 B·720,060 inst, 25개 218,010 B, 100개
263,119 B·12,399,171 inst, 반복 2회 바이트·inst 동일. 기능당 초기 JS
약 610 B, lazy 약 8.3 KB·8파일, inst 약 117k, tsc 메모리 약 36 MB,
route 4개.
- 재현: 같은 트리에서 --sizes=0,25 --repeats=1을 다시 돌려 0개 202,509 B,
25개 218,010 B로 같음.
- GREEN: feature-shape-growth.test.ts 5 passed(빌드 측정 테스트 포함).
- tsc(node·test), eslint(바꾼 2파일), verify-documentation-readiness
PASS_SCOPED.
Refs: docs/reviews/2026-09-29-maturity-review/11-tests-browser-release-scale.md 11-05
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
"axes": [
|
||||
{
|
||||
"axis": "Typecheck of one app",
|
||||
"verified": "Linear, about 115k instantiations and 37 MB of tsc memory per feature, up to 100 features",
|
||||
"verified": "Linear, about 117k instantiations and 36 MB of tsc memory per feature, up to 100 features",
|
||||
"condition": "Reference-shaped features, tsconfig.app.json, the host recorded in the baseline",
|
||||
"notVerified": "200 features (one full context) and beyond; 4,000 (20 x 200) would need on the order of 150 GB by the same slope"
|
||||
},
|
||||
@@ -21,13 +21,13 @@
|
||||
},
|
||||
{
|
||||
"axis": "Initial JavaScript",
|
||||
"verified": "15-01: only each feature's declaration (route table, messages, invalidation identities) loads at boot; its runtime half loads with its routes. Measured with scripts/scale/measure-feature-shape-growth.ts measureInitialJavascriptGzipBytes: 202,361 B with no copy, +741 B for the first copy, +648 B for the second, 205,629 B with five (before 15-01: +3,922 B per copy). tests/unit/feature-shape-growth.test.ts keeps one copy at or under 1 KiB",
|
||||
"verified": "15-01: only each feature's declaration (route table, messages, invalidation identities) loads at boot; its runtime half loads with its routes. Baseline: 202,509 B with no copy, about 610 B and no extra file per copy (218,010 B at 25, 263,119 B at 100; before 15-01: +3,922 B per copy). tests/unit/feature-shape-growth.test.ts keeps one copy at or under 1 KiB",
|
||||
"condition": "Same; the feature-declarations and feature-platform chunk groups in vite.config.ts",
|
||||
"notVerified": "The initial budget (204,800 B, config/performance/budgets.json) still fits only about three more reference-shaped features: the platform itself is 98.8% of it. The committed baseline (feature-shape-growth.json) predates 15-01"
|
||||
"notVerified": "The initial budget (204,800 B, config/performance/budgets.json) leaves 2,291 B over the baseline's 202,509 B, so about three more reference-shaped features fit at about 610 B each: the platform itself is 98.9% of it"
|
||||
},
|
||||
{
|
||||
"axis": "Lazy JavaScript",
|
||||
"verified": "About 6.8 KB gzip and six files per feature, every file far below the 120 KiB lazy-chunk budget",
|
||||
"verified": "About 8.3 KB gzip and eight files per feature, every file far below the 120 KiB lazy-chunk budget",
|
||||
"condition": "Same",
|
||||
"notVerified": "Download cost of many lazy files"
|
||||
},
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"measuredAt": "2026-09-27T04:03:00.821Z",
|
||||
"measuredAt": "2026-11-01T13:47:49.428Z",
|
||||
"command": "node scripts/scale/measure-feature-shape-growth.ts --sizes=0,25,100 --repeats=2",
|
||||
"environment": {
|
||||
"node": "24.14.0",
|
||||
"platform": "linux",
|
||||
"arch": "x64",
|
||||
"cpuModel": "Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz",
|
||||
"logicalCpus": 12,
|
||||
"availableParallelism": 12,
|
||||
"cpuModel": "Intel(R) Core(TM) Ultra 7 155H",
|
||||
"logicalCpus": 22,
|
||||
"availableParallelism": 22,
|
||||
"typescript": "Version 7.0.2",
|
||||
"vite": "vite/8.1.5 linux-x64 node-v24.14.0"
|
||||
},
|
||||
"source": {
|
||||
"commit": "2be973a13416b834e6690928e72433c0b3061105",
|
||||
"modifiedPaths": [
|
||||
"scripts/scale/measure-feature-shape-growth.ts",
|
||||
"tests/unit/feature-shape-growth.test.ts"
|
||||
]
|
||||
},
|
||||
"sourceFeature": "src/features/reference-feature",
|
||||
"runs": [
|
||||
{
|
||||
@@ -21,29 +28,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 840,
|
||||
"types": 284678,
|
||||
"symbols": 802946,
|
||||
"instantiations": 712089,
|
||||
"memoryKb": 520454,
|
||||
"wallMs": 3408
|
||||
"files": 843,
|
||||
"types": 287932,
|
||||
"symbols": 805529,
|
||||
"instantiations": 720060,
|
||||
"memoryKb": 523871,
|
||||
"wallMs": 2025
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 1208,
|
||||
"initialJavascriptFiles": 13,
|
||||
"initialJavascriptGzipBytes": 200001,
|
||||
"lazyJavascriptFiles": 14,
|
||||
"lazyJavascriptGzipBytes": 24938
|
||||
"wallMs": 440,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 202509,
|
||||
"lazyJavascriptFiles": 17,
|
||||
"lazyJavascriptGzipBytes": 28204
|
||||
},
|
||||
"loadBefore": [
|
||||
25.05,
|
||||
16.88,
|
||||
7.75
|
||||
28.38,
|
||||
18.41,
|
||||
14.76
|
||||
],
|
||||
"loadAfter": [
|
||||
26.4,
|
||||
17.3,
|
||||
7.93
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -53,29 +60,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 840,
|
||||
"types": 284678,
|
||||
"symbols": 802946,
|
||||
"instantiations": 712089,
|
||||
"memoryKb": 520395,
|
||||
"wallMs": 3930
|
||||
"files": 843,
|
||||
"types": 287932,
|
||||
"symbols": 805529,
|
||||
"instantiations": 720060,
|
||||
"memoryKb": 524012,
|
||||
"wallMs": 1056
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 1526,
|
||||
"initialJavascriptFiles": 13,
|
||||
"initialJavascriptGzipBytes": 200001,
|
||||
"lazyJavascriptFiles": 14,
|
||||
"lazyJavascriptGzipBytes": 24938
|
||||
"wallMs": 425,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 202509,
|
||||
"lazyJavascriptFiles": 17,
|
||||
"lazyJavascriptGzipBytes": 28204
|
||||
},
|
||||
"loadBefore": [
|
||||
26.4,
|
||||
17.3,
|
||||
7.93
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
],
|
||||
"loadAfter": [
|
||||
27.65,
|
||||
17.71,
|
||||
8.12
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -85,29 +92,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 1366,
|
||||
"types": 1055723,
|
||||
"symbols": 2831441,
|
||||
"instantiations": 3579093,
|
||||
"memoryKb": 1422337,
|
||||
"wallMs": 8121
|
||||
"files": 1394,
|
||||
"types": 1061481,
|
||||
"symbols": 2870282,
|
||||
"instantiations": 3646451,
|
||||
"memoryKb": 1431472,
|
||||
"wallMs": 4271
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 1676,
|
||||
"initialJavascriptFiles": 39,
|
||||
"initialJavascriptGzipBytes": 274493,
|
||||
"lazyJavascriptFiles": 165,
|
||||
"lazyJavascriptGzipBytes": 171638
|
||||
"wallMs": 1451,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 218010,
|
||||
"lazyJavascriptFiles": 218,
|
||||
"lazyJavascriptGzipBytes": 235404
|
||||
},
|
||||
"loadBefore": [
|
||||
27.65,
|
||||
17.71,
|
||||
8.12
|
||||
26.67,
|
||||
18.22,
|
||||
14.72
|
||||
],
|
||||
"loadAfter": [
|
||||
27.17,
|
||||
17.93,
|
||||
8.29
|
||||
28.86,
|
||||
18.82,
|
||||
14.93
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -117,29 +124,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 1366,
|
||||
"types": 1055723,
|
||||
"symbols": 2831441,
|
||||
"instantiations": 3579093,
|
||||
"memoryKb": 1422431,
|
||||
"wallMs": 8714
|
||||
"files": 1394,
|
||||
"types": 1061481,
|
||||
"symbols": 2870282,
|
||||
"instantiations": 3646451,
|
||||
"memoryKb": 1431193,
|
||||
"wallMs": 6960
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 2140,
|
||||
"initialJavascriptFiles": 39,
|
||||
"initialJavascriptGzipBytes": 274493,
|
||||
"lazyJavascriptFiles": 165,
|
||||
"lazyJavascriptGzipBytes": 171638
|
||||
"wallMs": 1722,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 218010,
|
||||
"lazyJavascriptFiles": 218,
|
||||
"lazyJavascriptGzipBytes": 235404
|
||||
},
|
||||
"loadBefore": [
|
||||
27.17,
|
||||
17.93,
|
||||
8.29
|
||||
28.86,
|
||||
18.82,
|
||||
14.93
|
||||
],
|
||||
"loadAfter": [
|
||||
27.55,
|
||||
18.46,
|
||||
8.62
|
||||
29.79,
|
||||
19.35,
|
||||
15.15
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -149,29 +156,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 2941,
|
||||
"types": 3349868,
|
||||
"symbols": 8940533,
|
||||
"instantiations": 12157304,
|
||||
"memoryKb": 4195900,
|
||||
"wallMs": 31315
|
||||
"files": 3044,
|
||||
"types": 3366002,
|
||||
"symbols": 9084067,
|
||||
"instantiations": 12399171,
|
||||
"memoryKb": 4224229,
|
||||
"wallMs": 11353
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 6010,
|
||||
"initialJavascriptFiles": 114,
|
||||
"initialJavascriptGzipBytes": 490658,
|
||||
"lazyJavascriptFiles": 615,
|
||||
"lazyJavascriptGzipBytes": 704938
|
||||
"wallMs": 878,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 263119,
|
||||
"lazyJavascriptFiles": 818,
|
||||
"lazyJavascriptGzipBytes": 857445
|
||||
},
|
||||
"loadBefore": [
|
||||
27.43,
|
||||
18.59,
|
||||
8.71
|
||||
29.4,
|
||||
19.44,
|
||||
15.2
|
||||
],
|
||||
"loadAfter": [
|
||||
29.72,
|
||||
20.12,
|
||||
9.64
|
||||
26.66,
|
||||
19.18,
|
||||
15.16
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -181,29 +188,29 @@
|
||||
"tsc": {
|
||||
"passed": true,
|
||||
"firstError": null,
|
||||
"files": 2941,
|
||||
"types": 3349868,
|
||||
"symbols": 8940533,
|
||||
"instantiations": 12157304,
|
||||
"memoryKb": 4195704,
|
||||
"wallMs": 43234
|
||||
"files": 3044,
|
||||
"types": 3366002,
|
||||
"symbols": 9084067,
|
||||
"instantiations": 12399171,
|
||||
"memoryKb": 4224168,
|
||||
"wallMs": 13664
|
||||
},
|
||||
"build": {
|
||||
"wallMs": 3702,
|
||||
"initialJavascriptFiles": 114,
|
||||
"initialJavascriptGzipBytes": 490658,
|
||||
"lazyJavascriptFiles": 615,
|
||||
"lazyJavascriptGzipBytes": 704938
|
||||
"wallMs": 2302,
|
||||
"initialJavascriptFiles": 16,
|
||||
"initialJavascriptGzipBytes": 263119,
|
||||
"lazyJavascriptFiles": 818,
|
||||
"lazyJavascriptGzipBytes": 857445
|
||||
},
|
||||
"loadBefore": [
|
||||
29.72,
|
||||
20.12,
|
||||
9.64
|
||||
26.66,
|
||||
19.18,
|
||||
15.16
|
||||
],
|
||||
"loadAfter": [
|
||||
35.75,
|
||||
22.97,
|
||||
11.09
|
||||
23.48,
|
||||
18.92,
|
||||
15.16
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -216,6 +216,28 @@ async function measureOnce(root: string, features: number) {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 11-05 (2026-09-29). The commit the run measured, so a later run can be
|
||||
* compared with the same code and a reader can tell whether the baseline
|
||||
* still describes the tree. Tracked files that differed from that commit are
|
||||
* listed; an empty list means the commit alone reproduces the run.
|
||||
*/
|
||||
function sourceRevision(): Readonly<{ commit: string; modifiedPaths: string[] }> {
|
||||
const git = (...args: string[]) => spawnSync("git", args, { encoding: "utf8" });
|
||||
const head = git("rev-parse", "HEAD");
|
||||
const status = git("status", "--porcelain", "--untracked-files=no");
|
||||
if (head.status !== 0 || status.status !== 0) {
|
||||
throw new Error("feature-shape growth: cannot read the source commit (git rev-parse HEAD, git status)");
|
||||
}
|
||||
return {
|
||||
commit: head.stdout.trim(),
|
||||
modifiedPaths: status.stdout
|
||||
.split("\n")
|
||||
.filter(Boolean)
|
||||
.map((line) => line.slice(3)),
|
||||
};
|
||||
}
|
||||
|
||||
function version(bin: string): string {
|
||||
const result = spawnSync(path.resolve("node_modules/.bin", bin), ["--version"], { encoding: "utf8" });
|
||||
return (result.stdout ?? "").trim();
|
||||
@@ -229,6 +251,8 @@ async function main(): Promise<void> {
|
||||
if (!sizes.every((size) => Number.isSafeInteger(size) && size >= 0) || !(repeats >= 1)) {
|
||||
throw new TypeError("--sizes must be nonnegative integers and --repeats at least 1");
|
||||
}
|
||||
// Read before measuring: the run takes minutes and the tree may move.
|
||||
const source = sourceRevision();
|
||||
const runs = [];
|
||||
for (const features of sizes) {
|
||||
const root = await createFixture(features);
|
||||
@@ -266,6 +290,7 @@ async function main(): Promise<void> {
|
||||
typescript: version("tsc"),
|
||||
vite: version("vite"),
|
||||
},
|
||||
source,
|
||||
sourceFeature: SOURCE_FEATURE,
|
||||
runs,
|
||||
};
|
||||
|
||||
@@ -67,12 +67,19 @@ describe("feature-shape growth measurement (11-04)", () => {
|
||||
await readFile(FEATURE_SHAPE_BASELINE_PATH, "utf8"),
|
||||
) as Readonly<{
|
||||
environment: Readonly<Record<string, unknown>>;
|
||||
source: unknown;
|
||||
runs: readonly Run[];
|
||||
}>;
|
||||
expect(baseline.environment).toMatchObject({
|
||||
cpuModel: expect.any(String),
|
||||
logicalCpus: expect.any(Number),
|
||||
});
|
||||
// 11-05 (2026-09-29). Without the commit it measured, nobody can tell
|
||||
// whether the baseline still describes the code or compare a new run.
|
||||
expect(baseline.source).toEqual({
|
||||
commit: expect.stringMatching(/^[0-9a-f]{40}$/u),
|
||||
modifiedPaths: expect.any(Array),
|
||||
});
|
||||
|
||||
const bySize = (size: number) =>
|
||||
baseline.runs.filter((run) => run.addedFeatures === size);
|
||||
|
||||
Reference in New Issue
Block a user