From b305389dc741dfe3fb5300d4383ade4cddb2ba3e Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Thu, 27 Jun 2024 01:56:54 -0700 Subject: bench: Fix for Windows and use fmtDuration --- bench/src/ziglyph_width.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bench/src/ziglyph_width.zig') diff --git a/bench/src/ziglyph_width.zig b/bench/src/ziglyph_width.zig index 01dd9ee..b923d24 100644 --- a/bench/src/ziglyph_width.zig +++ b/bench/src/ziglyph_width.zig @@ -3,14 +3,14 @@ const std = @import("std"); const display_width = @import("ziglyph").display_width; pub fn main() !void { - var args_iter = std.process.args(); - _ = args_iter.skip(); - const in_path = args_iter.next() orelse return error.MissingArg; - var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const allocator = arena.allocator(); + var args_iter = try std.process.argsWithAllocator(allocator); + _ = args_iter.skip(); + const in_path = args_iter.next() orelse return error.MissingArg; + const input = try std.fs.cwd().readFileAlloc( allocator, in_path, @@ -26,5 +26,5 @@ pub fn main() !void { const width = try display_width.strWidth(line, .half); result += width; } - std.debug.print("Ziglyph display_width.strWidth: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); + std.debug.print("Ziglyph display_width.strWidth: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); } -- cgit v1.2.3