mirror of
https://github.com/chmln/sd
synced 2024-11-12 22:47:13 +00:00
Test out buffered writes
This commit is contained in:
parent
977f2cb8a1
commit
3242ef602d
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,7 @@ use regex::bytes::Regex;
|
|||
use std::{
|
||||
fs::File,
|
||||
io::prelude::*,
|
||||
io::BufWriter,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
|
@ -124,7 +125,8 @@ impl Replacer {
|
|||
|
||||
if !replaced.is_empty() {
|
||||
let mut mmap_target = unsafe { MmapMut::map_mut(&file)? };
|
||||
mmap_target.deref_mut().write_all(&replaced)?;
|
||||
BufWriter::with_capacity(1_000_000_000, mmap_target.deref_mut())
|
||||
.write_all(&replaced)?;
|
||||
mmap_target.flush_async()?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue