1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-01 21:47:46 +00:00

tac: opportunistically use memory maps

Since tac must read its input files completely to start processing them
from the end, it is particularly suited to use memory maps to benefit
from the page cache maintained by the operating systems to bring the
necessary data into memory as required.

This does also include situations where the input is stdin, but not via
a pipe but for example a file descriptor set up by the user's shell
through an input redirection.
This commit is contained in:
Adam Reichold 2021-10-06 21:08:11 +02:00
parent 4eab275235
commit c526df57b8
3 changed files with 68 additions and 17 deletions

10
Cargo.lock generated
View file

@ -1064,6 +1064,15 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
[[package]]
name = "memmap2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4647a11b578fead29cdbb34d4adef8dd3dc35b876c9c6d5240d83f205abfe96e"
dependencies = [
"libc",
]
[[package]]
name = "memoffset"
version = "0.6.4"
@ -3025,6 +3034,7 @@ version = "0.0.7"
dependencies = [
"clap",
"memchr 2.4.0",
"memmap2",
"regex",
"uucore",
"uucore_procs",