doNotOptimizeAway

This commit is contained in:
Jacob Sandlund
2025-09-06 14:55:21 -04:00
parent f86a3a9b50
commit c3994347c0
5 changed files with 30 additions and 42 deletions

View File

@@ -21,7 +21,7 @@ data_f: ?std.fs.File = null,
pub const Options = struct {
/// Which test to run.
mode: Mode = .ziglyph,
mode: Mode = .uucode,
/// The data to read as a filepath. If this is "-" then
/// we will read stdin. If this is unset, then we will
@@ -32,8 +32,8 @@ pub const Options = struct {
};
pub const Mode = enum {
/// "Naive" ziglyph implementation.
ziglyph,
/// uucode implementation
uucode,
/// Ghostty's table-based approach.
table,
@@ -57,7 +57,7 @@ pub fn destroy(self: *IsSymbol, alloc: Allocator) void {
pub fn benchmark(self: *IsSymbol) Benchmark {
return .init(self, .{
.stepFn = switch (self.opts.mode) {
.ziglyph => stepZiglyph,
.uucode => stepUucode,
.table => stepTable,
},
.setupFn = setup,
@@ -85,7 +85,7 @@ fn teardown(ptr: *anyopaque) void {
}
}
fn stepZiglyph(ptr: *anyopaque) Benchmark.Error!void {
fn stepUucode(ptr: *anyopaque) Benchmark.Error!void {
const self: *IsSymbol = @ptrCast(@alignCast(ptr));
const f = self.data_f orelse return;