From 1935944a0352e9d176f0718063327e686ece1948 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 25 Aug 2026 18:49:57 -0300 Subject: Bound the edit path's document scans, and find out they were never the problem The board half: the -Dprof attribution that overturned the conclusion, its data, and the report correction. `-Dprof` adds two cycle-counter reads around `pardes_p4_input` and `pardes_p4_render` and prints both. Off by default: it puts a line on the wire per frame, which is the very resource being measured, so it answers "where did the 15 ms go" and not "how fast is it". It answered. Input is flat at ~220 us regardless of document size - 1.5% of a keystroke - and the entire ~15 ms floor plus every microsecond of the per-character slope live in `render`. The edit-path fix that the source reading implied (committed next door in 02-pardes-code) is worth 20% on a 19 MB file and, measured here over 5 conditions x 7 trials, exactly 0% on this board. `experiments/report.typ` gains Experiment 3 and a correction: Experiment 2's mechanism claim was wrong, says so, and carries the disproof beside it. The ranked recommendations are reordered with the renderer at #1. Also here: `--sweep position` in p4-bench, which holds the document fixed at one 320-character line and moves only the cursor. Column 320 costs 33.9 ms and emits 28 bytes; column 0 costs 26.0 ms and emits 81. Latency and output size are inverted on this board - the signature of a walk from the start of a line. --- build.zig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index e02b2d6..3053d13 100644 --- a/build.zig +++ b/build.zig @@ -104,6 +104,10 @@ pub fn build(b: *std.Build) void { const options = b.addOptions(); options.addOption(u8, "led_pin", led_pin); options.addOption(u32, "stack_size", stack_size); + // On-board attribution: time `pardes_p4_input` and `pardes_p4_render` separately and print the + // cycle counts. Off by default because it puts a line on the wire per frame, which is the very + // resource being measured - it answers "where did the 34 ms go", not "how fast is it". + options.addOption(bool, "prof", b.option(bool, "prof", "print per-phase cycle counts (pardes)") orelse false); options.addOption([]const u8, "wifi_ssid", wifi_ssid); options.addOption([]const u8, "wifi_psk", if (psk_file) |path| blk: { const raw = std.Io.Dir.cwd().readFileAlloc(b.graph.io, path, b.allocator, .limited(256)) catch -- cgit v1.3