summaryrefslogtreecommitdiff
path: root/test/perf.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/perf.zig')
-rw-r--r--test/perf.zig21
1 files changed, 11 insertions, 10 deletions
diff --git a/test/perf.zig b/test/perf.zig
index c9235954..7662d028 100644
--- a/test/perf.zig
+++ b/test/perf.zig
@@ -517,8 +517,8 @@ fn gate(cells: *const [std.enums.values(Op).len][fixtures.len]Cell, base: *const
};
// Typing beside a twin costs about what typing alone does, whatever the
// baseline: the twin takes the splice, never a copy of the text.
- const twin_op = @intFromEnum(Op.edit_twin);
- const alone_op = @intFromEnum(Op.edit_char);
+ const twin_op = @backingInt(Op.edit_twin);
+ const alone_op = @backingInt(Op.edit_char);
for (fixtures, 0..) |fx, fi| {
const twin = cells[twin_op][fi].min_us;
const alone = cells[alone_op][fi].min_us;
@@ -1054,7 +1054,7 @@ fn measureTerminalSession(io: std.Io, mib: usize, reps: usize, json: bool) !void
.undo_output = undo_output,
.history_rows = state.vt.screens.active.pages.scrollbar().total,
.history_bytes = state.vt.screens.active.pages.page_size,
- .history_limit_bytes = state.vt.screens.active.pages.maxSize(),
+ .history_limit_bytes = state.vt.screens.active.pages.limits.max(.bytes),
.row_count_decreases = row_count_decreases,
.allocator_calls = counter.calls,
.allocator_live_after_output = live_after_output,
@@ -1220,7 +1220,7 @@ fn measureMini(io: std.Io, fallback: std.mem.Allocator, reps: usize, json: bool)
break :blk try pardes.syntax.highlightFileRange(gpa, path, source, 0, source.len);
};
defer gpa.free(styles);
- if (styles.len != source.len or std.mem.indexOfScalar(u8, styles, @intFromEnum(pardes.syntax.Syn.comment)) == null)
+ if (styles.len != source.len or std.mem.indexOfScalar(u8, styles, @backingInt(pardes.syntax.Syn.comment)) == null)
return error.MiniSyntaxUnavailable;
const expected = try pardes.panes.mini.generate(gpa, source, styles);
defer expected.deinit(gpa);
@@ -1385,7 +1385,7 @@ fn reportText(
for (fixtures) |fx| {
if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name});
}
- o("\n{s}\n", .{if (base != null) "-" ** (12 + fixtures.len * 20) else "-" ** (12 + fixtures.len * 13)});
+ o("\n{s}\n", .{if (base != null) &@as([12 + fixtures.len * 20]u8, @splat('-')) else &@as([12 + fixtures.len * 13]u8, @splat('-'))});
var worst_jitter: f64 = 0;
for (std.enums.values(Op), 0..) |op, oi| {
o("{s:<12}", .{op.label()});
@@ -1412,7 +1412,7 @@ fn reportText(
for (term_fixtures) |fx| {
if (base != null) o(" {s:>19}", .{fx.name}) else o(" {s:>12}", .{fx.name});
}
- o("\n{s}\n", .{if (base != null) "-" ** (12 + term_fixtures.len * 20) else "-" ** (12 + term_fixtures.len * 13)});
+ o("\n{s}\n", .{if (base != null) &@as([12 + term_fixtures.len * 20]u8, @splat('-')) else &@as([12 + term_fixtures.len * 13]u8, @splat('-'))});
for (std.enums.values(TermOp), 0..) |op, oi| {
o("{s:<12}", .{op.label()});
for (0..term_fixtures.len) |fi| {
@@ -1524,10 +1524,11 @@ fn parseBase(src: []const u8, opts: Options, bytes: *const [fixtures.len]usize)
defer parsed.deinit();
const report = parsed.value;
if (!std.mem.eql(u8, report.harness, harness_id)) return error.BaselineHarnessMismatch;
- inline for (std.meta.fields(BuildIdentity)) |field| {
- const before = @field(report.build, field.name);
- const after = @field(build_identity, field.name);
- const same = if (field.type == []const u8) std.mem.eql(u8, before, after) else before == after;
+ const info = @typeInfo(BuildIdentity).@"struct";
+ inline for (info.field_names, info.field_types) |name, T| {
+ const before = @field(report.build, name);
+ const after = @field(build_identity, name);
+ const same = if (T == []const u8) std.mem.eql(u8, before, after) else before == after;
if (!same) return error.BaselineBuildMismatch;
}
if (report.cols != opts.cols or report.rows != opts.rows or report.reps != opts.reps or