summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-29 16:55:47 -0300
committerGabriel Schneider <[email protected]>2026-10-29 19:54:26 -0300
commit1c87b21d9255d9b0a7af102afd7defec25ac2c8a (patch)
tree1bf647be56591971e0a6320f15742ceb4e547d08 /build.zig
parent6a6e1b2cb3e328d5abd4435c1c2659f4e4e31eb8 (diff)
downloadpardes-1c87b21d9255d9b0a7af102afd7defec25ac2c8a.tar.gz
pardes-1c87b21d9255d9b0a7af102afd7defec25ac2c8a.zip
rollback-bench and fork_stall.py: what a replica's rollback copy is (a walk of ~100 KB once file texts are pinned) and what a fork stalls the authority for, which settle open points 3 and 5
`zig build rollback-bench -Dplatform=tty -Doptimize=ReleaseFast` (test/rollback_bench.zig) builds a typical session (a shell with 1 MB of scrollback, three 60 KB files and a 3 MB one, 40 edits) and a big one (14 panes, 18 MB, 4x3 MB and 8 small files, 8 MB of scrollback, 200 edits) in process, then measures the state the digest walk visits, the part of it that is a file's text and its undo snapshots (immutable once made: an edit puts a new buffer in place, a snapshot is a copy, so a copy pins them), and the walk again with those taken out, plus a memcpy of what is left. Typical: 36.3 MB walked, 80 KB to copy, about 0.02 ms; big: 282.5 MB, 96 KB, about 0.045 ms. Then a fork of the big session (431 MB RSS: 3.4 to 8.3 ms) and 64 MB written by the parent under the child (~28 ms of copy-on-write). test/fork_stall.py does the fork alone, on any system with a Python (the FreeBSD box): N MB written, then fork() timed and 64 MB written under the child, with Linux's THP as set and with 4 KiB pages. 1 GB: 13.3 to 19.6 ms here, 20.4 ms on FreeBSD 15.1; the copy-on-write after it ~1.3 us a page on both. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 24476753..13cb8ebc 100644
--- a/build.zig
+++ b/build.zig
@@ -1495,6 +1495,15 @@ pub fn build(b: *std.Build) void {
const lspbench_check_step = b.step("lspbench-check", "require every configured language probe to complete correctly");
lspbench_check_step.dependOn(&run_lspbench_check.step);
+ const rollback_bench = b.addExecutable(.{
+ .name = "pardes-rollback-bench",
+ .root_module = b.createModule(.{ .target = target, .optimize = optimize, .root_source_file = b.path("test/rollback_bench.zig"), .link_libc = true }),
+ });
+ rollback_bench.root_module.addImport("pardes", core_module);
+ const run_rollback_bench = b.addRunArtifact(rollback_bench);
+ run_rollback_bench.has_side_effects = true;
+ b.step("rollback-bench", "a replica's rollback copy (walked state, pinned blobs, walk time) for a typical and a big session, and a fork of the big one (-Doptimize=ReleaseFast)").dependOn(&run_rollback_bench.step);
+
const locations_bench_step = b.step("locations-bench", "measure cold/warm result formatting (-Doptimize=ReleaseFast; CSV on stderr)");
if (optimize != .fast) {
locations_bench_step.dependOn(&b.addFail("locations-bench requires -Doptimize=ReleaseFast").step);