An interface-typed *field* inside a struct (`Scene { IMat m; ... }`), with n implementations selected at runtime through a switch. Unlike `dynamic_dispatch` (a bare local existential), boxing the existential in an aggregate forces `legalizeExistentialTypeLayout` to float the existential field out and recompute the parent layout, and feeds specializeModule a witness-table-per-case blowup. Stresses specializeModule + legalizeExistentialTypeLayout + the downstream simplifyIR. Scales by breadth (number of implementations / switch cases). Scaling null: n scales cases, each an O(1) body; ideal specialization cost is O(n).
bucket: dynamic_dispatch · mode: target · flags: -target spirv -emit-spirv-directly
compileInner split into phase buckets (named leaves + (self) residuals) stacked across the sweep sizes — the top edge is compileInner, so you can see which phase drives the scaling.
floor-subtracted power-law fit (t − floor) = a·Nk; floor = the minimal workload (fixed per-compile cost), k the global exponent, top-2× the local high-end doubling ratio.
| N range | floor (ms) | k (work) | fit R² | t(Nmin) | t(Nmax) | top-2× |
|---|---|---|---|---|---|---|
| 50–400 | 11 | 1.13 | 0.992 | 54 | 466 | 2.46× |
compileInner grows by 412 ms across the sweep; the mutually-exclusive phase buckets below partition that growth exactly (no nested-timer double counting). × lin is the same metric as the top-level panels, per bucket: the end point vs a linear expectation anchored to the bucket's share of the minimal floor and fitted on the low-N half — 1.0 = grew exactly linearly, >1 bends up. The super-linearity lives where × lin (and k) are red.
| bucket | t@N=50 | t@N=400 | Δ ms | share | × lin | ∝Nk |
|---|---|---|---|---|---|---|
| specializeModule | 9 | 221 | +211 | 51% | 2.64× | 1.54 |
| generateOutput (self) | 9 | 58 | +49 | 12% | 1.09× | 1.03 |
| simplifyIR | 7 | 55 | +48 | 12% | 1.06× | 1.00 |
| linkAndOptimizeIR (self) | 6 | 45 | +39 | 9% | 1.04× | 1.01 |
| generateIR | 6 | 31 | +25 | 6% | 1.01× | 0.90 |
Also growing (below top-5): SemanticChecking (+22 ms, 5%).
Near-constant (≤2% of growth each): legalizeExistentialTypeLayout (1→6 ms), legalizeResourceTypes (0→4 ms), linkIR (1→4 ms), parseTranslationUnit (1→3 ms), performMandatoryEarlyInlining (0→2 ms), unrollLoopsInModule (0→1 ms), performForceInlining (0→1 ms), frontEndExecute (self) (0→1 ms), compileInner (self) (0→0 ms).
| N | compileInner | specializeModule | legalizeExistentialTypeLayout | simplifyIR |
|---|---|---|---|---|
| 50 | 54 | 9 | 1 | 7 |
| 100 | 91 | 22 | 2 | 13 |
| 200 | 189 | 65 | 3 | 26 |
| 400 | 466 | 221 | 6 | 55 |