diff options
Diffstat (limited to 'bench/src/zg_caseless.zig')
| -rw-r--r-- | bench/src/zg_caseless.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bench/src/zg_caseless.zig b/bench/src/zg_caseless.zig index fd0266d..9320a45 100644 --- a/bench/src/zg_caseless.zig +++ b/bench/src/zg_caseless.zig | |||
| @@ -4,14 +4,14 @@ const CaseFold = @import("CaseFold"); | |||
| 4 | const Normalize = @import("Normalize"); | 4 | const Normalize = @import("Normalize"); |
| 5 | 5 | ||
| 6 | pub fn main() !void { | 6 | pub fn main() !void { |
| 7 | var args_iter = std.process.args(); | ||
| 8 | _ = args_iter.skip(); | ||
| 9 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 10 | |||
| 11 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 7 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 12 | defer arena.deinit(); | 8 | defer arena.deinit(); |
| 13 | const allocator = arena.allocator(); | 9 | const allocator = arena.allocator(); |
| 14 | 10 | ||
| 11 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 12 | _ = args_iter.skip(); | ||
| 13 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 14 | |||
| 15 | const input = try std.fs.cwd().readFileAlloc( | 15 | const input = try std.fs.cwd().readFileAlloc( |
| 16 | allocator, | 16 | allocator, |
| 17 | in_path, | 17 | in_path, |
| @@ -41,7 +41,7 @@ pub fn main() !void { | |||
| 41 | @memcpy(buf[0..line.len], line); | 41 | @memcpy(buf[0..line.len], line); |
| 42 | prev_line = buf[0..line.len]; | 42 | prev_line = buf[0..line.len]; |
| 43 | } | 43 | } |
| 44 | std.debug.print("zg CaseFold.compatCaselessMatch: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 44 | std.debug.print("zg CaseFold.compatCaselessMatch: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 45 | 45 | ||
| 46 | result = 0; | 46 | result = 0; |
| 47 | iter.reset(); | 47 | iter.reset(); |
| @@ -57,5 +57,5 @@ pub fn main() !void { | |||
| 57 | @memcpy(buf[0..line.len], line); | 57 | @memcpy(buf[0..line.len], line); |
| 58 | prev_line = buf[0..line.len]; | 58 | prev_line = buf[0..line.len]; |
| 59 | } | 59 | } |
| 60 | std.debug.print("zg CaseFold.canonCaselessMatch: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 60 | std.debug.print("zg CaseFold.canonCaselessMatch: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 61 | } | 61 | } |