summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
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("."));