summaryrefslogtreecommitdiff
path: root/test/pdf_pointer_bench.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 22:58:53 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitb1485c97b493f7eaf65c6afdfb82e3065306b8fe (patch)
tree890d411820859ef33f1adf3164176fe29e007961 /test/pdf_pointer_bench.zig
parentf0e162d287f44a562ff79e7c1d2cf81ace00c836 (diff)
downloadpardes-b1485c97b493f7eaf65c6afdfb82e3065306b8fe.tar.gz
pardes-b1485c97b493f7eaf65c6afdfb82e3065306b8fe.zip
The PDF benches share their clock, fatal exit, hash, count parser and effect drain, and lspprobe is lspbench's probe subcommand
B4: test/bench_util.zig holds what pdf_bench, pdf_pointer_bench, pdf_scroll_bench and pdf_sections_bench each copied (nowNs x4, fatal x3 named per bench, mix x3, parsePositive/parseCount x3, drainEffects x2). They stay four entry points: pdf_bench links its own mupdf module (with its C source and c_heap) where the others link the core's, which one executable cannot import under one name, and their reports and identities are each bench's own. pdf_sections_bench had rotted since the pane's cursor and selections moved to its body and the render revision became next_raster_revision; it builds and runs again. C6: tools/lspprobe.zig is lspbench's `probe` subcommand (zig build lspbench -- probe <kind> <file> <line>:<col>), and the lspprobe build step goes; docs/lsp.md names the new command. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'test/pdf_pointer_bench.zig')
-rw-r--r--test/pdf_pointer_bench.zig14
1 files changed, 3 insertions, 11 deletions
diff --git a/test/pdf_pointer_bench.zig b/test/pdf_pointer_bench.zig
index f1d61229..ae2de2f5 100644
--- a/test/pdf_pointer_bench.zig
+++ b/test/pdf_pointer_bench.zig
@@ -15,6 +15,9 @@
//! frame each step settles on. It is the no-regression proof: a change to how highlights
//! are painted may change what it costs, never one presented pixel.
const std = @import("std");
+const bench_util = @import("bench_util.zig");
+const nowNs = bench_util.nowNs;
+const mix = bench_util.mix;
const pardes = @import("pardes");
const pdf = @import("mupdf");
@@ -208,17 +211,6 @@ fn print(comptime format: []const u8, args: anytype) void {
_ = std.c.write(1, line.ptr, line.len);
}
-fn mix(seed: u64, value: anytype) u64 {
- var copy = value;
- return std.hash.Wyhash.hash(seed, std.mem.asBytes(&copy));
-}
-
-fn nowNs() u64 {
- var ts: std.c.timespec = undefined;
- _ = std.c.clock_gettime(.MONOTONIC, &ts);
- return @as(u64, @intCast(ts.sec)) * 1_000_000_000 + @as(u64, @intCast(ts.nsec));
-}
-
comptime {
_ = pdf.Document;
}