diff options
| author | 2024-07-18 08:04:58 -0400 | |
|---|---|---|
| committer | 2024-07-18 08:04:58 -0400 | |
| commit | 7ddce488e074c3f052949ba513a340446cea86e9 (patch) | |
| tree | d546332da78d3cb061c9b98c72f6b39c8a394b2e /bench/src | |
| parent | Merge pull request 'refactor CodePoint.Iterator into a reusable fn' (#11) fro... (diff) | |
| download | zg-7ddce488e074c3f052949ba513a340446cea86e9.tar.gz zg-7ddce488e074c3f052949ba513a340446cea86e9.tar.xz zg-7ddce488e074c3f052949ba513a340446cea86e9.zip | |
Fixed benchmark duration printing
Diffstat (limited to 'bench/src')
| -rw-r--r-- | bench/src/zg_case.zig | 4 | ||||
| -rw-r--r-- | bench/src/zg_caseless.zig | 4 | ||||
| -rw-r--r-- | bench/src/zg_codepoint.zig | 2 | ||||
| -rw-r--r-- | bench/src/zg_grapheme.zig | 2 | ||||
| -rw-r--r-- | bench/src/zg_normalize.zig | 10 | ||||
| -rw-r--r-- | bench/src/zg_width.zig | 2 | ||||
| -rw-r--r-- | bench/src/ziglyph_case.zig | 4 | ||||
| -rw-r--r-- | bench/src/ziglyph_caseless.zig | 2 | ||||
| -rw-r--r-- | bench/src/ziglyph_codepoint.zig | 2 | ||||
| -rw-r--r-- | bench/src/ziglyph_grapheme.zig | 2 | ||||
| -rw-r--r-- | bench/src/ziglyph_normalizer.zig | 10 | ||||
| -rw-r--r-- | bench/src/ziglyph_width.zig | 2 |
12 files changed, 23 insertions, 23 deletions
diff --git a/bench/src/zg_case.zig b/bench/src/zg_case.zig index 2c9cdc0..7308e82 100644 --- a/bench/src/zg_case.zig +++ b/bench/src/zg_case.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 32 | std.debug.print("zg toUpperStr/toLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 42 | std.debug.print("zg isUpperStr/isLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 43 | } | 43 | } |
diff --git a/bench/src/zg_caseless.zig b/bench/src/zg_caseless.zig index 9320a45..fa350e9 100644 --- a/bench/src/zg_caseless.zig +++ b/bench/src/zg_caseless.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 44 | std.debug.print("zg CaseFold.compatCaselessMatch: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 60 | std.debug.print("zg CaseFold.canonCaselessMatch: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 61 | } | 61 | } |
diff --git a/bench/src/zg_codepoint.zig b/bench/src/zg_codepoint.zig index af83199..7a8ccbe 100644 --- a/bench/src/zg_codepoint.zig +++ b/bench/src/zg_codepoint.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 26 | std.debug.print("zg CodePointIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 27 | } | 27 | } |
diff --git a/bench/src/zg_grapheme.zig b/bench/src/zg_grapheme.zig index d004da1..74fb8b5 100644 --- a/bench/src/zg_grapheme.zig +++ b/bench/src/zg_grapheme.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 28 | std.debug.print("zg GraphemeIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 29 | } | 29 | } |
diff --git a/bench/src/zg_normalize.zig b/bench/src/zg_normalize.zig index fb0d4ee..1e2cfab 100644 --- a/bench/src/zg_normalize.zig +++ b/bench/src/zg_normalize.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 33 | std.debug.print("zg Normalize.nfkc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 43 | std.debug.print("zg Normalize.nfc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 53 | std.debug.print("zg Normalize.nfkd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 63 | std.debug.print("zg Normalize.nfd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 76 | std.debug.print("Zg Normalize.eql: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 77 | } | 77 | } |
diff --git a/bench/src/zg_width.zig b/bench/src/zg_width.zig index 5ee8fe9..041d2c5 100644 --- a/bench/src/zg_width.zig +++ b/bench/src/zg_width.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 32 | std.debug.print("zg DisplayWidth.strWidth: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 33 | } | 33 | } |
diff --git a/bench/src/ziglyph_case.zig b/bench/src/ziglyph_case.zig index 2b49e5a..f6dfbc1 100644 --- a/bench/src/ziglyph_case.zig +++ b/bench/src/ziglyph_case.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 30 | std.debug.print("Ziglyph toUpperStr/toLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 40 | std.debug.print("Ziglyph isUpperStr/isLowerStr: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 41 | } | 41 | } |
diff --git a/bench/src/ziglyph_caseless.zig b/bench/src/ziglyph_caseless.zig index 842de44..4a22c22 100644 --- a/bench/src/ziglyph_caseless.zig +++ b/bench/src/ziglyph_caseless.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 34 | std.debug.print("Ziglyph Normalizer.eqlCaseless: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 35 | } | 35 | } |
diff --git a/bench/src/ziglyph_codepoint.zig b/bench/src/ziglyph_codepoint.zig index 4265d97..7fe4028 100644 --- a/bench/src/ziglyph_codepoint.zig +++ b/bench/src/ziglyph_codepoint.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 26 | std.debug.print("Ziglyph CodePointIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 27 | } | 27 | } |
diff --git a/bench/src/ziglyph_grapheme.zig b/bench/src/ziglyph_grapheme.zig index 4ce9da1..4fae2b0 100644 --- a/bench/src/ziglyph_grapheme.zig +++ b/bench/src/ziglyph_grapheme.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 26 | std.debug.print("Ziglyph GraphemeIterator: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 27 | } | 27 | } |
diff --git a/bench/src/ziglyph_normalizer.zig b/bench/src/ziglyph_normalizer.zig index fa077f4..e1e4c1b 100644 --- a/bench/src/ziglyph_normalizer.zig +++ b/bench/src/ziglyph_normalizer.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 31 | std.debug.print("Ziglyph Normalizer.nfkc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 41 | std.debug.print("Ziglyph Normalizer.nfc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 51 | std.debug.print("Ziglyph Normalizer.nfkd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 61 | std.debug.print("Ziglyph Normalizer.nfd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 74 | std.debug.print("Ziglyph Normalizer.eql: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 75 | } | 75 | } |
diff --git a/bench/src/ziglyph_width.zig b/bench/src/ziglyph_width.zig index b923d24..590ac3e 100644 --- a/bench/src/ziglyph_width.zig +++ b/bench/src/ziglyph_width.zig | |||
| @@ -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, std.fmt.fmtDuration(timer.lap() / std.time.ns_per_ms) }); | 29 | std.debug.print("Ziglyph display_width.strWidth: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); |
| 30 | } | 30 | } |