4 ms·
I wouldn't say it's a nit. The file may be 10s of GB. Do you want to read it to a string?
by noncoml 3y 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?
- raggi 3y agoThe 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.
- noncoml 3y agoI was talking about this: let mut file = File::open(path)?; let mut contents = String::new(); file.read_to_string(&mut contents)?;