Skip to content

Commit ef8d9c8

Browse files
committed
Record compact edge metadata experiment
AI-assisted change (OpenAI Codex).
1 parent b26372d commit ef8d9c8

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

PERF_RESEARCH_LOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,25 @@ A fresh exp31 control measured 1,861,551,104 instructions on `slow` and
11191119
flat. These nested-slider searches are too rare to matter on the focused
11201120
inputs, so the extra representation was reverted.
11211121

1122+
### exp33: store edge depth differences as `u8` — REJECTED
1123+
1124+
`Edge::UnchangedNode` and `EnterUnchangedDelimiter` stored a `u32` depth
1125+
difference even though edge costs cap the value at 40. Following a historical
1126+
branch, the fields were changed to saturating `u8` values and widened only
1127+
inside `Edge::cost`.
1128+
1129+
Five-run means regressed from the fresh exp31 control:
1130+
1131+
| pair | `u32` depth | `u8` depth | change |
1132+
| --- | ---: | ---: | ---: |
1133+
| `slow` | 1,861,551,104 | 1,889,546,037 | **+1.50%** |
1134+
| `typing` | 3,065,110,465 | 3,070,731,701 | **+0.18%** |
1135+
1136+
The `(Edge, &Vertex)` neighbour representation remains pointer-aligned, so the
1137+
smaller enum does not shrink the hot neighbour entries. Saturating on edge
1138+
construction and widening during cost calculation instead add work. The change
1139+
was reverted.
1140+
11221141
## Where this leaves things
11231142

11241143
| workload | earlier reference | now | change |

plan.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ than mixing counts across environments.
311311
| 30 | add the combined edge only for different delimiters | +6.84% `slow`, +0.54% `typing` | rejected |
312312
| 31 | dispatch parent pops from one stack-head lookup | -0.41% `slow`, flat on `typing` | kept |
313313
| 32 | replace nested-slider vectors with a bounded accumulator | flat on both focused pairs | rejected |
314+
| 33 | store edge depth differences as `u8` | +1.50% `slow`, +0.18% `typing` | rejected |
314315

315316
Every completed experiment is committed and pushed. `results/` holds labelled
316317
callgrind tables through `exp13-linear-visible-width`; experiments that only
@@ -333,22 +334,17 @@ the percentages above predate exp25-31.
333334
`compute_neighbours`/`allocate_if_new` that can be removed on an existing
334335
edge. Exp28 and exp31 show that exact parent-stack reductions pay; exp10
335336
shows that merely decomposing candidate construction does not.
336-
2. **Measure compact `Edge` metadata.** A historical search branch stores
337-
depth differences as `u8`; current costs cap them at 40 but the enum carries
338-
`u32`. First check `size_of::<Edge>()` and generated code. A smaller enum only
339-
matters if it reduces copying or the `(Edge, &Vertex)` neighbour/route
340-
representation; alignment may erase the apparent saving.
341-
3. **Target real tree-sitter work on `typing`.** Exp27 proved capture-bucket
337+
2. **Target real tree-sitter work on `typing`.** Exp27 proved capture-bucket
342338
lookup itself is negligible. Investigate query matching, syntax cursor
343339
traversal, or duplicated tree walking. Type highlights affect colour but,
344340
unlike comments and strings, appear not to affect content equality; a
345341
no-colour fast path is only valid after tracing `AtomKind::Type` through
346342
parsing, matching, and every output mode. Do not assume this from the name.
347-
4. **Consider phase-specific instrumentation.** The unmerged
343+
3. **Consider phase-specific instrumentation.** The unmerged
348344
`claude/codspeed-ci-setup-ahqufj` benchmark separates parse and diff. Adapt
349345
it locally if whole-process profiles cannot distinguish a `typing` change;
350346
do not broaden the benchmark inputs beyond the two focused pairs.
351-
5. **Algorithmic splitting only with explicit output review.** Historical
347+
4. **Algorithmic splitting only with explicit output review.** Historical
352348
pre-diff splitting and unique-atom branches can dramatically reduce graph
353349
work, but they change which optimal diff is selected. The current exact
354350
output oracle will reject them. Record such a proposal separately and seek
@@ -367,6 +363,8 @@ the percentages above predate exp25-31.
367363
- Do not optimize capture classification alone (exp27: -0.03%, noise).
368364
- Do not replace nested-slider scratch vectors with a bounded accumulator;
369365
those searches were flat on both focused pairs (exp32).
366+
- Do not compact edge depth fields to `u8`; pointer alignment preserves the
367+
neighbour-entry size and conversions regressed both pairs (exp33).
370368
- Do not remove `ChangeState::UnchangedDelimiter`; prior work found it is
371369
required and its removal panics.
372370

0 commit comments

Comments
 (0)