baseNM: read ahead

This commit is contained in:
oech3
2026-06-03 10:05:36 +02:00
committed by Daniel Hofstetter
parent 9da057e558
commit e3b680d647
3 changed files with 4 additions and 0 deletions
Generated
+1
View File
@@ -3214,6 +3214,7 @@ version = "0.9.0"
dependencies = [
"clap",
"fluent",
"rustix",
"uucore",
]
+1
View File
@@ -20,6 +20,7 @@ doctest = false
[dependencies]
clap = { workspace = true }
rustix = { workspace = true }
uucore = { workspace = true, features = ["encoding"] }
fluent = { workspace = true }
+2
View File
@@ -152,6 +152,8 @@ pub fn get_input(config: &Config) -> UResult<Box<dyn BufRead>> {
Some(path_buf) => {
let file =
File::open(path_buf).map_err_context(|| path_buf.maybe_quote().to_string())?;
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))]
let _ = rustix::fs::fadvise(&file, 0, None, rustix::fs::Advice::Sequential);
Ok(Box::new(BufReader::with_capacity(DEFAULT_BUF_SIZE, file)))
}
None => {