Chunk dimensions of 2^32 or more; copy-free unfiltered 4 GiB writes #32
@@ -289,7 +289,12 @@ fn write_file_atomically_with<E: From<std::io::Error>>(
|
|||||||
let tmp_path = path.with_file_name(tmp_name);
|
let tmp_path = path.with_file_name(tmp_name);
|
||||||
|
|
||||||
let result = (|| -> Result<(), E> {
|
let result = (|| -> Result<(), E> {
|
||||||
let mut f = std::io::BufWriter::with_capacity(1 << 20, std::fs::File::create(&tmp_path)?);
|
// 64 KiB, below glibc's 128 KiB mmap threshold: a 1 MiB buffer was
|
||||||
|
// mapped afresh by each write once the threshold had not risen, and
|
||||||
|
// its page faults made a 1 MiB chunked write 1.6x slower (criterion
|
||||||
|
// `write_2d_chunked/512x512` after the smaller cases, 2026-09-29).
|
||||||
|
// Writes larger than the buffer go straight to the file.
|
||||||
|
let mut f = std::io::BufWriter::with_capacity(64 << 10, std::fs::File::create(&tmp_path)?);
|
||||||
write(&mut f)?;
|
write(&mut f)?;
|
||||||
f.flush()?;
|
f.flush()?;
|
||||||
f.get_ref().sync_all()?;
|
f.get_ref().sync_all()?;
|
||||||
|
|||||||
Reference in New Issue
Block a user