From 036923515ec05b07c381448402fc256d9c564c10 Mon Sep 17 00:00:00 2001 From: Sam Atman Date: Fri, 16 May 2025 13:13:01 -0400 Subject: Remove benchmarks, ziglyph references `ziglyph` is no longer maintained and basically abandoned, there's no need to keep the comparison between them active going forward. --- bench/src/zg_normalize.zig | 77 ---------------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 bench/src/zg_normalize.zig (limited to 'bench/src/zg_normalize.zig') diff --git a/bench/src/zg_normalize.zig b/bench/src/zg_normalize.zig deleted file mode 100644 index 1e2cfab..0000000 --- a/bench/src/zg_normalize.zig +++ /dev/null @@ -1,77 +0,0 @@ -const std = @import("std"); - -const Normalize = @import("Normalize"); - -pub fn main() !void { - 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, - std.math.maxInt(u32), - ); - defer allocator.free(input); - - var norm_data: Normalize.NormData = undefined; - try Normalize.NormData.init(&norm_data, allocator); - const normalize = Normalize{ .norm_data = &norm_data }; - - var iter = std.mem.splitScalar(u8, input, '\n'); - var result: usize = 0; - var timer = try std.time.Timer.start(); - - while (iter.next()) |line| { - const nfkc = try normalize.nfkc(allocator, line); - result += nfkc.slice.len; - } - std.debug.print("zg Normalize.nfkc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); - - result = 0; - iter.reset(); - timer.reset(); - - while (iter.next()) |line| { - const nfc = try normalize.nfc(allocator, line); - result += nfc.slice.len; - } - std.debug.print("zg Normalize.nfc: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); - - result = 0; - iter.reset(); - timer.reset(); - - while (iter.next()) |line| { - const nfkd = try normalize.nfkd(allocator, line); - result += nfkd.slice.len; - } - std.debug.print("zg Normalize.nfkd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); - - result = 0; - iter.reset(); - timer.reset(); - - while (iter.next()) |line| { - const nfd = try normalize.nfd(allocator, line); - result += nfd.slice.len; - } - std.debug.print("zg Normalize.nfd: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); - - result = 0; - iter.reset(); - var buf: [256]u8 = [_]u8{'z'} ** 256; - var prev_line: []const u8 = buf[0..1]; - timer.reset(); - - while (iter.next()) |line| { - if (try normalize.eql(allocator, prev_line, line)) result += 1; - @memcpy(buf[0..line.len], line); - prev_line = buf[0..line.len]; - } - std.debug.print("Zg Normalize.eql: result: {}, took: {}\n", .{ result, std.fmt.fmtDuration(timer.lap()) }); -} -- cgit v1.2.3