Skip to content

Commit

Permalink
opt buffer in main
Browse files Browse the repository at this point in the history
  • Loading branch information
StringNick committed Jul 9, 2024
1 parent 14f6ea9 commit a060ae1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cmd/cmd.zig
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ fn runProgram(allocator: std.mem.Allocator, _cfg: Args) !void {
try runner.vm.writeOutput(output_buffer.writer());
}

var writer: std.io.BufferedWriter(5 * 1024 * 1024, std.fs.File.Writer) = .{ .unbuffered_writer = undefined };

if (_cfg.trace_file) |trace_path| {
const relocated_trace = runner.relocated_trace orelse return errors.TraceError.TraceNotRelocated;

var writer: std.io.BufferedWriter(3 * 1024 * 1024, std.fs.File.Writer) = .{ .unbuffered_writer = undefined };

const trace_file = try std.fs.cwd().createFile(trace_path, .{});
defer trace_file.close();

Expand All @@ -307,8 +307,6 @@ fn runProgram(allocator: std.mem.Allocator, _cfg: Args) !void {
}

if (_cfg.memory_file) |memory_path| {
var writer: std.io.BufferedWriter(5 * 1024 * 1024, std.fs.File.Writer) = .{ .unbuffered_writer = undefined };

const memory_file = try std.fs.cwd().createFile(memory_path, .{});
defer memory_file.close();

Expand Down

0 comments on commit a060ae1

Please sign in to comment.