summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-14 22:38:50 -0300
committerGabriel Schneider <[email protected]>2026-08-15 11:58:29 -0300
commitbe2a9957708cbf0c478ca861c4a1f0f227bbfe10 (patch)
tree1abf5cb65057048ebfbce7fc427289a437a693f4 /build.zig
parentf67fec978a9296c651ec06bd2f43686d34ff86ee (diff)
downloadpardes-be2a9957708cbf0c478ca861c4a1f0f227bbfe10.tar.gz
pardes-be2a9957708cbf0c478ca861c4a1f0f227bbfe10.zip
pdf: continuous scroll bench harness and per-frame render path
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig10
1 files changed, 9 insertions, 1 deletions
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("."));