Skip to content

File.Writer splatByteAll with high splat value is slow on Windows #24783

@ilmaria

Description

@ilmaria

Zig Version

0.15.0-dev.1438+242102f9d

Steps to Reproduce and Observed Behavior

Filling a file with zeroes with splatByteAll writes one byte at a time and is very slow.

pub fn main() !void {
    const out_file = try std.fs.cwd().createFile("output", .{ .truncate = true });
    var buf: [4096]u8 = @splat(0);
    var w = out_file.writer(&buf);
    try w.interface.splatByteAll(0, 100_000_000);
}

const std = @import("std");

Expected Behavior

I expected splatByteAll to use the writer buffer and write as many bytes at a time as possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions