Corpus shape #2 — the growing shared package. Real monorepos concentrate * files in a few large packages (org. .common, …), and the JVM filter * branch includes every def sharing the file's namespace — so per-file work * tracks PACKAGE size. A package whose file count scales with the corpus is * therefore the honest reproducer for the #1669 growth pattern that fully * independent modules
| 276 | * be linear in k, while a namespace/module-scoped per-file registry build |
| 277 | * goes quadratic. */ |
| 278 | static int cx_build_bigpkg(const char *root, int k) { |
| 279 | char dir[1024]; |
| 280 | char path[1200]; |
| 281 | snprintf(dir, sizeof(dir), "%s/bigsrc/bigpkg", root); |
| 282 | if (th_mkdir_p(dir) != 0) { |
| 283 | return -1; |
| 284 | } |
| 285 | int files = k * CX_BIGPKG_FILES_PER_K; |
| 286 | for (int j = 0; j < files; j++) { |
| 287 | snprintf(path, sizeof(path), "%s/B%d.java", dir, j); |
| 288 | FILE *f = fopen(path, "w"); |
| 289 | if (!f) { |
| 290 | return -1; |
| 291 | } |
| 292 | fprintf(f, "package bigpkg;\n\npublic class B%d {\n", j); |
| 293 | fprintf(f, " public int val%d(int x) {\n return x + %d;\n }\n", j, j); |
| 294 | if (j > 0) { |
| 295 | fprintf(f, " public int chain() {\n"); |
| 296 | fprintf(f, " B%d prev = new B%d();\n", j - 1, j - 1); |
| 297 | fprintf(f, " return prev.val%d(1) + val%d(2);\n }\n", j - 1, j); |
| 298 | } else { |
| 299 | fprintf(f, " public int chain() {\n return val0(2);\n }\n"); |
| 300 | } |
| 301 | fprintf(f, "}\n"); |
| 302 | fclose(f); |
| 303 | } |
| 304 | return 0; |
| 305 | } |
| 306 | |
| 307 | /* ── Metrics ─────────────────────────────────────────────────────────── */ |
| 308 |
no test coverage detected