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/zg_width.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bench/src/zg_width.zig') diff --git a/bench/src/zg_width.zig b/bench/src/zg_width.zig index c0ce57c..5ee8fe9 100644 --- a/bench/src/zg_width.zig +++ b/bench/src/zg_width.zig @@ -3,14 +3,14 @@ const std = @import("std"); const DisplayWidth = @import("DisplayWidth"); 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, @@ -29,5 +29,5 @@ pub fn main() !void { const width = display_width.strWidth(line); result += width; } - std.debug.print("zg DisplayWidth.strWidth: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); + std.debug.print("zg DisplayWidth.strWidth: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); } -- cgit v1.2.3