Skip to content

Commit

Permalink
fix: truncate long benchmark name
Browse files Browse the repository at this point in the history
  • Loading branch information
AxelDelsol committed Jul 25, 2024
1 parent 36c7117 commit fe30c39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zbench.zig
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,9 @@ pub const Result = struct {

const timings_ns = self.readings.timings_ns;
const s = try Statistics(u64).init(allocator, timings_ns);
const truncated_name = self.name[0..@min(22, self.name.len)];
// Benchmark name, number of iterations, and total time
try writer.print("{s:<22} ", .{self.name});
try writer.print("{s:<22} ", .{truncated_name});
try setColor(colors, writer, Color.cyan);
try writer.print("{d:<8} {s:<15}", .{
self.readings.iterations,
Expand Down Expand Up @@ -383,7 +384,7 @@ pub const Result = struct {
const m = try Statistics(usize).init(allocator, allocs.maxes);
// Benchmark name
const name = try std.fmt.bufPrint(&buf, "{s} [MEMORY]", .{
self.name,
truncated_name,
});
try writer.print("{s:<46} ", .{name});
// Mean + standard deviation
Expand Down

0 comments on commit fe30c39

Please sign in to comment.