From be2a9957708cbf0c478ca861c4a1f0f227bbfe10 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 14 Aug 2026 22:38:50 -0300 Subject: pdf: continuous scroll bench harness and per-frame render path --- build.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index 80e995b6..1df6e8dd 100644 --- a/build.zig +++ b/build.zig @@ -496,11 +496,15 @@ pub fn build(b: *std.Build) void { // bench: what it measures is one shell frame — a whole batch of // wheel notches through update() followed by a single render() — // so it needs the production core, not the raster wrapper alone. + // The exe follows -Doptimize with the core rather than pinning + // ReleaseFast: a profile or a crash in the harness itself needs the + // same line numbers and un-inlined frames as one in the core, and a + // scoreboard run passes ReleaseFast anyway (see the file header). const pdf_scroll_bench = b.addExecutable(.{ .name = "pardes-pdf-scroll-bench", .root_module = b.createModule(.{ .target = target, - .optimize = .ReleaseFast, + .optimize = optimize, .root_source_file = b.path("test/pdf_scroll_bench.zig"), .link_libc = true, }), @@ -509,7 +513,11 @@ pub fn build(b: *std.Build) void { pdf_scroll_bench.root_module.addImport("mupdf", mupdf_mod); const scroll_bench_opts = b.addOptions(); scroll_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast); + scroll_bench_opts.addOption([]const u8, "core_optimize", @tagName(optimize)); pdf_scroll_bench.root_module.addOptions("pdf_scroll_bench_config", scroll_bench_opts); + // Installed, unlike the other two: `perf record zig-out/bin/...` + // needs a stable path, and a cache hash is not one. + b.installArtifact(pdf_scroll_bench); const run_pdf_scroll_bench = b.addRunArtifact(pdf_scroll_bench); if (b.args) |args| run_pdf_scroll_bench.addArgs(args); run_pdf_scroll_bench.setCwd(b.path(".")); -- cgit v1.3