cat: Improve performance on Linux (#1978)

* cat: Improve performance, especially on Linux

* cat: Don't use io::copy for splice fallback

On my MacBook Pro 2020, it is around 25% faster to not use io::copy.

* cat: Only fall back to generic copy if first splice fails

* cat: Don't double buffer stdout

* cat: Don't use experimental or-pattern syntax

* cat: Remove nix symbol use from non-Linux
This commit is contained in:
Árni Dagur
2021-04-01 23:08:48 +02:00
committed by GitHub
parent 2941dfd698
commit 7a947cfe46
3 changed files with 255 additions and 175 deletions
Generated
+4 -1
View File
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "advapi32-sys"
version = "0.2.0"
@@ -1581,7 +1583,8 @@ name = "uu_cat"
version = "0.0.4"
dependencies = [
"clap",
"quick-error",
"nix 0.20.0",
"thiserror",
"unix_socket",
"uucore",
"uucore_procs",
+4 -1
View File
@@ -16,13 +16,16 @@ path = "src/cat.rs"
[dependencies]
clap = "2.33"
quick-error = "1.2.3"
thiserror = "1.0"
uucore = { version=">=0.0.7", package="uucore", path="../../uucore", features=["fs"] }
uucore_procs = { version=">=0.0.5", package="uucore_procs", path="../../uucore_procs" }
[target.'cfg(unix)'.dependencies]
unix_socket = "0.5.0"
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
nix = "0.20"
[[bin]]
name = "cat"
path = "src/main.rs"
+247 -173
View File
File diff suppressed because it is too large Load Diff