Hacker News new | ask | show | jobs
by noncoml 814 days ago
I wouldn't say it's a nit. The file may be 10s of GB. Do you want to read it to a string?
1 comments

The buffered read didn’t do that, it used the default buffered reader implementation. IIRC that implementation currently defaults to 8kb buffer windows which is a little too small to be efficient enough for high throughput, but substantially more performant than making a syscall per byte, and without spending too much memory.
I was talking about this:

    let mut file = File::open(path)?;
    let mut contents = String::new();
    file.read_to_string(&mut contents)?;