Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Zig
uses: mlugg/setup-zig@v2
Expand Down
8 changes: 5 additions & 3 deletions src/bench.zig
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ fn mainInner(allocator: std.mem.Allocator, args: []const []const u8) !void {
if (benchMutool(allocator, pdf_path)) |mutool_ns| {
std.debug.print("MuPDF: {d:>8.2} ms\n", .{mutool_ns / 1e6});
std.debug.print("Speedup: {d:>8.2}x\n", .{mutool_ns / stats.mean});
} else |_| {
std.debug.print("(mutool not found)\n", .{});
} else |err| switch (err) {
error.MutoolFailed => std.debug.print("(mutool failed)\n", .{}),
else => std.debug.print("(mutool not found)\n", .{}),
}
}
}
Expand Down Expand Up @@ -127,7 +128,8 @@ const CharCounter = struct {
fn benchMutool(allocator: std.mem.Allocator, pdf_path: []const u8) !f64 {
const start = compat.nanoTimestamp();

_ = try compat.runIgnored(&.{ "mutool", "draw", "-F", "txt", "-o", "/dev/null", pdf_path }, allocator);
const exit_code = try compat.runIgnored(&.{ "mutool", "draw", "-F", "txt", "-o", "/dev/null", pdf_path }, allocator);
if (exit_code != 0) return error.MutoolFailed;
Comment thread
coderabbitai[bot] marked this conversation as resolved.

return @floatFromInt(compat.nanoTimestamp() - start);
}
Loading