kernel: perf batch A, O(1) UTF-16 columns and allocation removal across the walkers
The mechanical half of the kernel performance pass. Nothing here can change a verdict, so the byte-identical dump gate is the whole review.
The change that matters is the column service. Every walker measured a node's UTF-16 column by re-scanning the line prefix from the line start, twice per node and once per reference. That is linear in the line, so quadratic on a long line, and a minified bundle is one long line. textutil::Cols replaces it. An all-ASCII file reads columns straight off byte offsets. A non-ASCII file builds the UTF-16 prefix table once, on first use. The old col16 survives as the test oracle the new service is checked against.
The rest of the batch:
ids::node_idhex-encodes through a nibble table instead of sixteenformat!calls per id.- Node and edge kind lookups are
matchtables instead of linear scans over the kind lists. - The
{"valueRef":true}arena put is hoisted out of the value-reference loops in 13 walkers. - 29
collect()-then-iterate child walks became direct cursor iteration, and 21&x.clone()reference pushes became&x. - The TypeScript walker's
(name, line)String-keyed scoped-row andrequire()declarator lookups are line-keyed maps, and its line count comes from the column service instead of a third newline scan. - The doubled
markdown_refs_from_stringcalls in the C/C++ and TypeScript walks are gone. A string node reached the second call on the same path with nothing emitted in between, so reference order is unchanged. - Java's Lombok owner test uses
strip_prefixinstead of formatting a qualified name per node per class. The C paren-conversion regex runs only on a(-led callee. The fn-pointer sweep keeps each keyword's next hit instead of re-searching bothstructandunionto end of file per match. Threefrom_utf8_lossycopies becamefrom_utf8moves.tree.rsreusestextutil::utf16_prefix.
Kernel-only extraction, one thread, every file the index holds, best of 3, baseline kernel built from e8ecd153 and loaded through CODEGRAPH_KERNEL_PATH:
| corpus | files | before | after |
|---|---|---|---|
| koel | 2,051 | 484 ms | 461 ms |
| firefly-iii | 1,954 | 1,484 ms | 951 ms |
| warp-drive | 1,631 | 869 ms | 874 ms |
| halo | 2,251 | 865 ms | 815 ms |
| pretix | 1,417 | 2,762 ms | 2,263 ms |
| discourse | 15,564 | 29,919 ms | 10,742 ms |
At index level the parse loop is bound by the main thread's store, with six parse workers absorbing the walker time, so on this host the gain lands as CPU rather than wall (discourse 22.75 s to 22.60 s, peak RSS 5.56 GB to 5.42 GB). Ledger entry in docs/design/metrics-ledger.md, section 5.40.
Gate: dump-graph byte-identical against the baseline kernel on all 14 corpora; kernel unit tests 28/28, clippy -D warnings, ast-grep rules; full suite 303 files, 5,178 tests.