diff options
Diffstat (limited to 'bench/src')
| -rw-r--r-- | bench/src/zg_case.zig | 12 | ||||
| -rw-r--r-- | bench/src/zg_caseless.zig | 12 | ||||
| -rw-r--r-- | bench/src/zg_codepoint.zig | 10 | ||||
| -rw-r--r-- | bench/src/zg_grapheme.zig | 10 | ||||
| -rw-r--r-- | bench/src/zg_normalize.zig | 18 | ||||
| -rw-r--r-- | bench/src/zg_width.zig | 10 | ||||
| -rw-r--r-- | bench/src/ziglyph_case.zig | 12 | ||||
| -rw-r--r-- | bench/src/ziglyph_caseless.zig | 10 | ||||
| -rw-r--r-- | bench/src/ziglyph_codepoint.zig | 10 | ||||
| -rw-r--r-- | bench/src/ziglyph_grapheme.zig | 10 | ||||
| -rw-r--r-- | bench/src/ziglyph_normalizer.zig | 18 | ||||
| -rw-r--r-- | bench/src/ziglyph_width.zig | 10 |
12 files changed, 71 insertions, 71 deletions
diff --git a/bench/src/zg_case.zig b/bench/src/zg_case.zig index e602c00..2c9cdc0 100644 --- a/bench/src/zg_case.zig +++ b/bench/src/zg_case.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const CaseData = @import("CaseData"); | 3 | const CaseData = @import("CaseData"); |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -29,7 +29,7 @@ pub fn main() !void { | |||
| 29 | const lower = try case_data.toLowerStr(allocator, line); | 29 | const lower = try case_data.toLowerStr(allocator, line); |
| 30 | result += upper.len + lower.len; | 30 | result += upper.len + lower.len; |
| 31 | } | 31 | } |
| 32 | std.debug.print("zg toUpperStr/toLowerStr: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 32 | std.debug.print("zg toUpperStr/toLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 33 | 33 | ||
| 34 | result = 0; | 34 | result = 0; |
| 35 | iter.reset(); | 35 | iter.reset(); |
| @@ -39,5 +39,5 @@ pub fn main() !void { | |||
| 39 | if (case_data.isUpperStr(line)) result += 1; | 39 | if (case_data.isUpperStr(line)) result += 1; |
| 40 | if (case_data.isLowerStr(line)) result += 2; | 40 | if (case_data.isLowerStr(line)) result += 2; |
| 41 | } | 41 | } |
| 42 | std.debug.print("zg isUpperStr/isLowerStr: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 42 | std.debug.print("zg isUpperStr/isLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 43 | } | 43 | } |
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 | } |
diff --git a/bench/src/zg_codepoint.zig b/bench/src/zg_codepoint.zig index 0564fa1..af83199 100644 --- a/bench/src/zg_codepoint.zig +++ b/bench/src/zg_codepoint.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const CodePointIterator = @import("code_point").Iterator; | 3 | const CodePointIterator = @import("code_point").Iterator; |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -23,5 +23,5 @@ pub fn main() !void { | |||
| 23 | var timer = try std.time.Timer.start(); | 23 | var timer = try std.time.Timer.start(); |
| 24 | 24 | ||
| 25 | while (iter.next()) |_| result += 1; | 25 | while (iter.next()) |_| result += 1; |
| 26 | std.debug.print("zg CodePointIterator: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 26 | std.debug.print("zg CodePointIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 27 | } | 27 | } |
diff --git a/bench/src/zg_grapheme.zig b/bench/src/zg_grapheme.zig index 106b970..d004da1 100644 --- a/bench/src/zg_grapheme.zig +++ b/bench/src/zg_grapheme.zig | |||
| @@ -4,14 +4,14 @@ const GraphemeData = @import("grapheme").GraphemeData; | |||
| 4 | const GraphemeIterator = @import("grapheme").Iterator; | 4 | const GraphemeIterator = @import("grapheme").Iterator; |
| 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, |
| @@ -25,5 +25,5 @@ pub fn main() !void { | |||
| 25 | var timer = try std.time.Timer.start(); | 25 | var timer = try std.time.Timer.start(); |
| 26 | 26 | ||
| 27 | while (iter.next()) |_| result += 1; | 27 | while (iter.next()) |_| result += 1; |
| 28 | std.debug.print("zg GraphemeIterator: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 28 | std.debug.print("zg GraphemeIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 29 | } | 29 | } |
diff --git a/bench/src/zg_normalize.zig b/bench/src/zg_normalize.zig index 87d07da..fb0d4ee 100644 --- a/bench/src/zg_normalize.zig +++ b/bench/src/zg_normalize.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const Normalize = @import("Normalize"); | 3 | const Normalize = @import("Normalize"); |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -30,7 +30,7 @@ pub fn main() !void { | |||
| 30 | const nfkc = try normalize.nfkc(allocator, line); | 30 | const nfkc = try normalize.nfkc(allocator, line); |
| 31 | result += nfkc.slice.len; | 31 | result += nfkc.slice.len; |
| 32 | } | 32 | } |
| 33 | std.debug.print("zg Normalize.nfkc: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 33 | std.debug.print("zg Normalize.nfkc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 34 | 34 | ||
| 35 | result = 0; | 35 | result = 0; |
| 36 | iter.reset(); | 36 | iter.reset(); |
| @@ -40,7 +40,7 @@ pub fn main() !void { | |||
| 40 | const nfc = try normalize.nfc(allocator, line); | 40 | const nfc = try normalize.nfc(allocator, line); |
| 41 | result += nfc.slice.len; | 41 | result += nfc.slice.len; |
| 42 | } | 42 | } |
| 43 | std.debug.print("zg Normalize.nfc: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 43 | std.debug.print("zg Normalize.nfc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 44 | 44 | ||
| 45 | result = 0; | 45 | result = 0; |
| 46 | iter.reset(); | 46 | iter.reset(); |
| @@ -50,7 +50,7 @@ pub fn main() !void { | |||
| 50 | const nfkd = try normalize.nfkd(allocator, line); | 50 | const nfkd = try normalize.nfkd(allocator, line); |
| 51 | result += nfkd.slice.len; | 51 | result += nfkd.slice.len; |
| 52 | } | 52 | } |
| 53 | std.debug.print("zg Normalize.nfkd: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 53 | std.debug.print("zg Normalize.nfkd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 54 | 54 | ||
| 55 | result = 0; | 55 | result = 0; |
| 56 | iter.reset(); | 56 | iter.reset(); |
| @@ -60,7 +60,7 @@ pub fn main() !void { | |||
| 60 | const nfd = try normalize.nfd(allocator, line); | 60 | const nfd = try normalize.nfd(allocator, line); |
| 61 | result += nfd.slice.len; | 61 | result += nfd.slice.len; |
| 62 | } | 62 | } |
| 63 | std.debug.print("zg Normalize.nfd: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 63 | std.debug.print("zg Normalize.nfd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 64 | 64 | ||
| 65 | result = 0; | 65 | result = 0; |
| 66 | iter.reset(); | 66 | iter.reset(); |
| @@ -73,5 +73,5 @@ pub fn main() !void { | |||
| 73 | @memcpy(buf[0..line.len], line); | 73 | @memcpy(buf[0..line.len], line); |
| 74 | prev_line = buf[0..line.len]; | 74 | prev_line = buf[0..line.len]; |
| 75 | } | 75 | } |
| 76 | std.debug.print("Zg Normalize.eql: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 76 | std.debug.print("Zg Normalize.eql: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 77 | } | 77 | } |
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"); | |||
| 3 | const DisplayWidth = @import("DisplayWidth"); | 3 | const DisplayWidth = @import("DisplayWidth"); |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -29,5 +29,5 @@ pub fn main() !void { | |||
| 29 | const width = display_width.strWidth(line); | 29 | const width = display_width.strWidth(line); |
| 30 | result += width; | 30 | result += width; |
| 31 | } | 31 | } |
| 32 | std.debug.print("zg DisplayWidth.strWidth: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 32 | std.debug.print("zg DisplayWidth.strWidth: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 33 | } | 33 | } |
diff --git a/bench/src/ziglyph_case.zig b/bench/src/ziglyph_case.zig index c6ef6ec..2b49e5a 100644 --- a/bench/src/ziglyph_case.zig +++ b/bench/src/ziglyph_case.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const ziglyph = @import("ziglyph"); | 3 | const ziglyph = @import("ziglyph"); |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -27,7 +27,7 @@ pub fn main() !void { | |||
| 27 | const lower = try ziglyph.toLowerStr(allocator, line); | 27 | const lower = try ziglyph.toLowerStr(allocator, line); |
| 28 | result += upper.len + lower.len; | 28 | result += upper.len + lower.len; |
| 29 | } | 29 | } |
| 30 | std.debug.print("Ziglyph toUpperStr/toLowerStr: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 30 | std.debug.print("Ziglyph toUpperStr/toLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 31 | 31 | ||
| 32 | result = 0; | 32 | result = 0; |
| 33 | iter.reset(); | 33 | iter.reset(); |
| @@ -37,5 +37,5 @@ pub fn main() !void { | |||
| 37 | if (ziglyph.isUpperStr(line)) result += 1; | 37 | if (ziglyph.isUpperStr(line)) result += 1; |
| 38 | if (ziglyph.isLowerStr(line)) result += 2; | 38 | if (ziglyph.isLowerStr(line)) result += 2; |
| 39 | } | 39 | } |
| 40 | std.debug.print("Ziglyph isUpperStr/isLowerStr: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 40 | std.debug.print("Ziglyph isUpperStr/isLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 41 | } | 41 | } |
diff --git a/bench/src/ziglyph_caseless.zig b/bench/src/ziglyph_caseless.zig index f80668e..842de44 100644 --- a/bench/src/ziglyph_caseless.zig +++ b/bench/src/ziglyph_caseless.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const Normalizer = @import("ziglyph").Normalizer; | 3 | const Normalizer = @import("ziglyph").Normalizer; |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -31,5 +31,5 @@ pub fn main() !void { | |||
| 31 | @memcpy(buf[0..line.len], line); | 31 | @memcpy(buf[0..line.len], line); |
| 32 | prev_line = buf[0..line.len]; | 32 | prev_line = buf[0..line.len]; |
| 33 | } | 33 | } |
| 34 | std.debug.print("Ziglyph Normalizer.eqlCaseless: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 34 | std.debug.print("Ziglyph Normalizer.eqlCaseless: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 35 | } | 35 | } |
diff --git a/bench/src/ziglyph_codepoint.zig b/bench/src/ziglyph_codepoint.zig index 4c8fc18..4265d97 100644 --- a/bench/src/ziglyph_codepoint.zig +++ b/bench/src/ziglyph_codepoint.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const CodePointIterator = @import("ziglyph").CodePointIterator; | 3 | const CodePointIterator = @import("ziglyph").CodePointIterator; |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -23,5 +23,5 @@ pub fn main() !void { | |||
| 23 | var timer = try std.time.Timer.start(); | 23 | var timer = try std.time.Timer.start(); |
| 24 | 24 | ||
| 25 | while (iter.next()) |_| result += 1; | 25 | while (iter.next()) |_| result += 1; |
| 26 | std.debug.print("Ziglyph CodePointIterator: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 26 | std.debug.print("Ziglyph CodePointIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 27 | } | 27 | } |
diff --git a/bench/src/ziglyph_grapheme.zig b/bench/src/ziglyph_grapheme.zig index b47eea3..4ce9da1 100644 --- a/bench/src/ziglyph_grapheme.zig +++ b/bench/src/ziglyph_grapheme.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const GraphemeIterator = @import("ziglyph").GraphemeIterator; | 3 | const GraphemeIterator = @import("ziglyph").GraphemeIterator; |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -23,5 +23,5 @@ pub fn main() !void { | |||
| 23 | var timer = try std.time.Timer.start(); | 23 | var timer = try std.time.Timer.start(); |
| 24 | 24 | ||
| 25 | while (iter.next()) |_| result += 1; | 25 | while (iter.next()) |_| result += 1; |
| 26 | std.debug.print("Ziglyph GraphemeIterator: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 26 | std.debug.print("Ziglyph GraphemeIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 27 | } | 27 | } |
diff --git a/bench/src/ziglyph_normalizer.zig b/bench/src/ziglyph_normalizer.zig index fea162c..fa077f4 100644 --- a/bench/src/ziglyph_normalizer.zig +++ b/bench/src/ziglyph_normalizer.zig | |||
| @@ -3,14 +3,14 @@ const std = @import("std"); | |||
| 3 | const Normalizer = @import("ziglyph").Normalizer; | 3 | const Normalizer = @import("ziglyph").Normalizer; |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -28,7 +28,7 @@ pub fn main() !void { | |||
| 28 | const nfkc = try normalizer.nfkc(allocator, line); | 28 | const nfkc = try normalizer.nfkc(allocator, line); |
| 29 | result += nfkc.slice.len; | 29 | result += nfkc.slice.len; |
| 30 | } | 30 | } |
| 31 | std.debug.print("Ziglyph Normalizer.nfkc: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 31 | std.debug.print("Ziglyph Normalizer.nfkc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 32 | 32 | ||
| 33 | result = 0; | 33 | result = 0; |
| 34 | iter.reset(); | 34 | iter.reset(); |
| @@ -38,7 +38,7 @@ pub fn main() !void { | |||
| 38 | const nfc = try normalizer.nfc(allocator, line); | 38 | const nfc = try normalizer.nfc(allocator, line); |
| 39 | result += nfc.slice.len; | 39 | result += nfc.slice.len; |
| 40 | } | 40 | } |
| 41 | std.debug.print("Ziglyph Normalizer.nfc: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 41 | std.debug.print("Ziglyph Normalizer.nfc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 42 | 42 | ||
| 43 | result = 0; | 43 | result = 0; |
| 44 | iter.reset(); | 44 | iter.reset(); |
| @@ -48,7 +48,7 @@ pub fn main() !void { | |||
| 48 | const nfkd = try normalizer.nfkd(allocator, line); | 48 | const nfkd = try normalizer.nfkd(allocator, line); |
| 49 | result += nfkd.slice.len; | 49 | result += nfkd.slice.len; |
| 50 | } | 50 | } |
| 51 | std.debug.print("Ziglyph Normalizer.nfkd: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 51 | std.debug.print("Ziglyph Normalizer.nfkd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 52 | 52 | ||
| 53 | result = 0; | 53 | result = 0; |
| 54 | iter.reset(); | 54 | iter.reset(); |
| @@ -58,7 +58,7 @@ pub fn main() !void { | |||
| 58 | const nfd = try normalizer.nfd(allocator, line); | 58 | const nfd = try normalizer.nfd(allocator, line); |
| 59 | result += nfd.slice.len; | 59 | result += nfd.slice.len; |
| 60 | } | 60 | } |
| 61 | std.debug.print("Ziglyph Normalizer.nfd: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 61 | std.debug.print("Ziglyph Normalizer.nfd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 62 | 62 | ||
| 63 | result = 0; | 63 | result = 0; |
| 64 | iter.reset(); | 64 | iter.reset(); |
| @@ -71,5 +71,5 @@ pub fn main() !void { | |||
| 71 | @memcpy(buf[0..line.len], line); | 71 | @memcpy(buf[0..line.len], line); |
| 72 | prev_line = buf[0..line.len]; | 72 | prev_line = buf[0..line.len]; |
| 73 | } | 73 | } |
| 74 | std.debug.print("Ziglyph Normalizer.eql: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 74 | std.debug.print("Ziglyph Normalizer.eql: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 75 | } | 75 | } |
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"); | |||
| 3 | const display_width = @import("ziglyph").display_width; | 3 | const display_width = @import("ziglyph").display_width; |
| 4 | 4 | ||
| 5 | pub fn main() !void { | 5 | pub fn main() !void { |
| 6 | var args_iter = std.process.args(); | ||
| 7 | _ = args_iter.skip(); | ||
| 8 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 9 | |||
| 10 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | 6 | var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); |
| 11 | defer arena.deinit(); | 7 | defer arena.deinit(); |
| 12 | const allocator = arena.allocator(); | 8 | const allocator = arena.allocator(); |
| 13 | 9 | ||
| 10 | var args_iter = try std.process.argsWithAllocator(allocator); | ||
| 11 | _ = args_iter.skip(); | ||
| 12 | const in_path = args_iter.next() orelse return error.MissingArg; | ||
| 13 | |||
| 14 | const input = try std.fs.cwd().readFileAlloc( | 14 | const input = try std.fs.cwd().readFileAlloc( |
| 15 | allocator, | 15 | allocator, |
| 16 | in_path, | 16 | in_path, |
| @@ -26,5 +26,5 @@ pub fn main() !void { | |||
| 26 | const width = try display_width.strWidth(line, .half); | 26 | const width = try display_width.strWidth(line, .half); |
| 27 | result += width; | 27 | result += width; |
| 28 | } | 28 | } |
| 29 | std.debug.print("Ziglyph display_width.strWidth: result: {}, took: {}\n", .{ result, timer.lap() / std.time.ns_per_ms }); | 29 | std.debug.print("Ziglyph display_width.strWidth: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); |
| 30 | } | 30 | } |