summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-03 10:02:00 -0300
committerGabriel Schneider <[email protected]>2026-08-10 09:17:07 -0300
commit7452ff1caf51942ba9561acf2aa284d50435b8c3 (patch)
tree5be0d58e16b3ee9810377131f1d83c06f10b69bf /build.zig
parentcd4a5b991104a2dc96a4bb7390451fb384376a9a (diff)
downloadpardes-7452ff1caf51942ba9561acf2aa284d50435b8c3.tar.gz
pardes-7452ff1caf51942ba9561acf2aa284d50435b8c3.zip
optimize and harness PDF sections navigation
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig28
1 files changed, 27 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index ff2dddfc..4957adb4 100644
--- a/build.zig
+++ b/build.zig
@@ -51,10 +51,13 @@ pub fn build(b: *std.Build) void {
const web_step = b.step("web", "build the DOM browser shell into zig-out/web (-Dplatform=web -Dtarget=wasm32-freestanding -Ddump=<dump.zon>)");
const mupdf_check = b.step("mupdf-check", "compile, link, render, and search docs/design.pdf with MuPDF");
const pdf_bench_step = b.step("pdf-bench", "benchmark real MuPDF page rendering (-- [--json] [--reps N] [--warmup N] [--path FILE] [--page N] [--pages N])");
+ const pdf_sections_bench_step = b.step("pdf-sections-bench", "benchmark PDF outline/sections paths in ReleaseFast (-Doptimize=ReleaseFast -- [--json] [--reps N] [--warmup N])");
if (!enable_mupdf)
mupdf_check.dependOn(&b.addFail("mupdf-check is unavailable with -Dmupdf=false").step);
if (!enable_mupdf)
pdf_bench_step.dependOn(&b.addFail("pdf-bench is unavailable with -Dmupdf=false").step);
+ if (!enable_mupdf)
+ pdf_sections_bench_step.dependOn(&b.addFail("pdf-sections-bench is unavailable with -Dmupdf=false").step);
// Web LOOK has a tiny read-only source filesystem. Generate one Zig module
// on the host from every tracked .zig path + its current working-tree
@@ -408,6 +411,29 @@ pub fn build(b: *std.Build) void {
if (b.args) |args| run_pdf_bench.addArgs(args);
run_pdf_bench.setCwd(b.path("."));
pdf_bench_step.dependOn(&run_pdf_bench.step);
+
+ // Unlike the raster-only scoreboard above, this one drives the
+ // real core so cached +PdfSections reopen and n/N include their
+ // production state transitions. Pass -Doptimize=ReleaseFast so
+ // hx_core_mod and its MuPDF wrapper share the executable's mode.
+ const pdf_sections_bench = b.addExecutable(.{
+ .name = "pardes-pdf-sections-bench",
+ .root_module = b.createModule(.{
+ .target = target,
+ .optimize = .ReleaseFast,
+ .root_source_file = b.path("test/pdf_sections_bench.zig"),
+ .link_libc = true,
+ }),
+ });
+ pdf_sections_bench.root_module.addImport("pardes", hx_core_mod);
+ pdf_sections_bench.root_module.addImport("mupdf", mupdf_mod);
+ const sections_bench_opts = b.addOptions();
+ sections_bench_opts.addOption(bool, "release_fast_core", optimize == .ReleaseFast);
+ pdf_sections_bench.root_module.addOptions("pdf_sections_bench_config", sections_bench_opts);
+ const run_pdf_sections_bench = b.addRunArtifact(pdf_sections_bench);
+ if (b.args) |args| run_pdf_sections_bench.addArgs(args);
+ run_pdf_sections_bench.setCwd(b.path("."));
+ pdf_sections_bench_step.dependOn(&run_pdf_sections_bench.step);
}
}
@@ -666,7 +692,7 @@ pub fn build(b: *std.Build) void {
// searchable two-page document. Keep it a distinct opt-in step: the
// ordinary image harness stays identical when MuPDF is disabled, and
// asking for PDF coverage without the feature gets an explicit error.
- const pdf_harness_step = b.step("pdf-harness", "exercise PDF rendering, page replacement, and search Look end to end");
+ const pdf_harness_step = b.step("pdf-harness", "exercise continuous PDF rendering, search, and sections navigation end to end");
if (enable_mupdf) {
const run_pdf_harness = b.addRunArtifact(image_harness);
run_pdf_harness.addArtifactArg(exe);