diff options
| author | andrewkraevskii <andrew.kraevskii@gmail.com> | 2025-09-12 21:25:48 +0300 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-09-18 22:39:33 -0700 |
| commit | de489031d873193ca94de1292828c00a02e3b3ea (patch) | |
| tree | 2a9e8a8e5e0b78311005d455d81e8bd2f0845b6e /lib/std/unicode | |
| parent | 37ecaae6390d238dce21ef4b97e6994dd229c2c3 (diff) | |
| download | zig-de489031d873193ca94de1292828c00a02e3b3ea.tar.gz zig-de489031d873193ca94de1292828c00a02e3b3ea.zip | |
Remove usages of deprecatedWriter
Diffstat (limited to 'lib/std/unicode')
| -rw-r--r-- | lib/std/unicode/throughput_test.zig | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/std/unicode/throughput_test.zig b/lib/std/unicode/throughput_test.zig index c13a38b101..fd3f46ec58 100644 --- a/lib/std/unicode/throughput_test.zig +++ b/lib/std/unicode/throughput_test.zig @@ -39,35 +39,44 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { } pub fn main() !void { - const stdout = std.fs.File.stdout().deprecatedWriter(); + // Size of buffer is about size of printed message. + var stdout_buffer: [0x100]u8 = undefined; + var stdout_writer = std.fs.File.stdout().writer(&stdout_buffer); + const stdout = &stdout_writer.interface; try stdout.print("short ASCII strings\n", .{}); + try stdout.flush(); { const result = try benchmarkCodepointCount("abc"); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("short Unicode strings\n", .{}); + try stdout.flush(); { const result = try benchmarkCodepointCount("ŌŌŌ"); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("pure ASCII strings\n", .{}); + try stdout.flush(); { const result = try benchmarkCodepointCount("hello" ** 16); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("pure Unicode strings\n", .{}); + try stdout.flush(); { const result = try benchmarkCodepointCount("こんにちは" ** 16); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } try stdout.print("mixed ASCII/Unicode strings\n", .{}); + try stdout.flush(); { const result = try benchmarkCodepointCount("Hyvää huomenta" ** 16); try stdout.print(" count: {:5} MiB/s [{d}]\n", .{ result.throughput / (1 * MiB), result.count }); } + try stdout.flush(); } |
