So i've used zig 0.16.0-dev.2368+380ea6fb5 (master)
ztracy(master) to track performance with tracy 0.13.1 profiler.
My specs are:
Windows 11.25H2 Pro
AMD Ryzen 5 5600H 3.30Hz
NVIDIA GeForce RTX 3050 Labtop
16 gb of RAM.
I've came up with this for master and i did the same for 0.15.2:
pub fn Print(comptime fmt: []const u8, args: anytype) !void {
const Zone = Engine.ztracy.ZoneNC(@src(), "Console print", 0xFF0000);
defer Zone.End();
const allocator = Allocator.allocator();
const count = try std.fmt.count(fmt, args);
const buf = try allocator.alloc(u8, count);
defer allocator.free(buf);
var stdout = std.Io.File.stdout().writer(buf);
try stdout.interface.print(fmt, args);
try stdout.flush();
}
as tracy can't give consistent exact time each time i'd operate on average values:
For 0.16(master) it's around 180-220 us(microseconds)
For 0.15.2 it's around 130-180 us(microseconds)
Both times i used Print("Hello, {s}\n", .{"world!"}) which in total is 14 bytes.
So same method is slower in master branch, but it think it can and should be improved with async IO, but i don't know how to make it efficiend so I hope you may provide some of your works to find out most efficient method of printing using zig master branch.