Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Private Function

fillUnbuffered

Private Function
std.Io.Reader.fillUnbuffered
fn fillUnbuffered(r: *Reader, n: usize) Error!void

This internal function is separated from fill to encourage optimizers to inline fill, hence propagating its @branchHint to usage sites. If these functions are combined, fill is large enough that LLVM is reluctant to inline it, forcing usages of APIs like takeInt to go through an expensive runtime function call just to figure out that the data is, in fact, already in the buffer.

Missing this optimization can result in wall-clock time for the most affected benchmarks increasing by a factor of 5 or more.

Params

Errors

ReadFailed

See the Reader implementation for detailed diagnostics.

EndOfStream

File

Io/Reader.zig:1125
1125
1126
1127
1128
1129
fn fillUnbuffered(r: *Reader, n: usize) Error!void {
    try rebase(r, n);
    var bufs: [1][]u8 = .{""};
    while (r.end < r.seek + n) _ = try r.vtable.readVec(r, &bufs);
}