|
| 1 | +# OCTETDB-PERF-M4 compiler provenance and specialization observations |
| 2 | + |
| 3 | +## Verdict |
| 4 | + |
| 5 | +The Oct compiler required no language or backend change for PERF-M4. Commit |
| 6 | +`ca22ab8dfc20ac6d6c59dd34976789cd2c84ad2e` generated the W5 safe-Go FLOW |
| 7 | +adapter through the existing experimental `internal/build.EmitGoSource` seam. |
| 8 | +A small evidence-only generator lives at `Experiments/PerfM4`; generated code |
| 9 | +was not hand edited. |
| 10 | + |
| 11 | +## Chosen specialization |
| 12 | + |
| 13 | +Profiling preceded the choice. Durable W1 was dominated by filesystem sync, so |
| 14 | +W1–W4 remained S0. W5 default full scans were dominated by JSON validation, |
| 15 | +decode, and allocation. Its Oct source declares a bounded `Job` record and |
| 16 | +four query FLOWs: filter, filter+take, filter+map, and count. Generated Go is a |
| 17 | +single fused state machine per query with array index cursor and emitted-count |
| 18 | +board state. There are no channels, goroutines, iterator runtime, unsafe, cgo, |
| 19 | +manual allocator, or handwritten repairs. |
| 20 | + |
| 21 | +## Provenance and size |
| 22 | + |
| 23 | +- Oct commit: `ca22ab8dfc20ac6d6c59dd34976789cd2c84ad2e`. |
| 24 | +- Oct source: 34 physical / 26 nonblank lines. |
| 25 | +- Generated safe Go: 1,473 physical / 1,339 nonblank lines, 46,598 bytes. |
| 26 | +- Generator wall time on the recorded Windows host: 448.69 ms first measured |
| 27 | + run, then 172.42 and 205.47 ms with warm Go build cache. |
| 28 | +- Runtime materialization median: 0.44 ms / 1k records, 3.89 ms / 10k, and |
| 29 | + 45.72 ms / 100k. |
| 30 | + |
| 31 | +## Result |
| 32 | + |
| 33 | +In the primary WSL matrix, the mixed W5 lane measured 219.7× default. Focused |
| 34 | +25%-selectivity full filters measured 63.4×, 68.1×, and 92.3× at 1k, 10k, and |
| 35 | +100k. Point lookup gained only 1.44× in WSL and does not use generated code. |
| 36 | +Mutation workloads gained no compiler-owned path and their S0 controls stayed |
| 37 | +near 1× subject to storage variance. |
| 38 | + |
| 39 | +## Product boundary exposed |
| 40 | + |
| 41 | +The compiler can generate the fast loop, but OctetDB v0.2.0 has no product-owned |
| 42 | +published read representation or transactional index update contract. PERF-M4 |
| 43 | +therefore uses S1 only for a read-only W5 dataset materialized from the durable |
| 44 | +Dataset at initialization. Extending that mirror to W6 would introduce a |
| 45 | +commit-to-publication race or a broad locking adapter; PERF-M4 refused both. |
| 46 | + |
| 47 | +This is compiler success plus integration evidence: the next missing piece is |
| 48 | +not a new query language feature. It is a product-owned coherence/publication |
| 49 | +boundary if OctetDB later prioritizes compiled query integration. |
0 commit comments