aboutsummaryrefslogtreecommitdiff
path: root/src/windows_sdk.cpp
diff options
context:
space:
mode:
authorr00ster91 <r00ster91@proton.me>2023-07-22 00:16:08 +0200
committerAndrew Kelley <andrew@ziglang.org>2023-07-21 21:32:18 -0700
commitd962ad5ea0290ea4b713f5546eb12032351cb7b9 (patch)
treecfec9eed2540ce60061257ad53dfe64126b27674 /src/windows_sdk.cpp
parent619140c0d2abd22da668747820f0ee80b497eb24 (diff)
downloadzig-d962ad5ea0290ea4b713f5546eb12032351cb7b9.tar.gz
zig-d962ad5ea0290ea4b713f5546eb12032351cb7b9.zip
codegen: writer().writeByteNTimes -> appendNTimes
Both ways do the same thing but I think the compiler might have an easier time optimizing `appendNTimes` because it does less things/the path is shorter. I have not done any benchmarking at runtime but have compared the instruction count of both ways a little here: https://zig.godbolt.org/z/vr193W9oj `b` (`appendNTimes`) is ~103 instructions while `a` (`writer().writeByteNTimes`) is ~117 instructions. And looking at the implementation of `writeByteNTimes`, it only seems to buffer up 256 bytes before doing another `writeAll` which for `std.ArrayList` probably means another allocation, whereas when directly using `appendNTimes`, the entire exact additional capacity required is known from the start. Either way, this would be more consistent anyway.
Diffstat (limited to 'src/windows_sdk.cpp')
0 files changed, 0 insertions, 0 deletions