Moved input lines on to stack if input is small. (merged from branch cli.)

Fortune for genmarkov's current commit: Small blessing − 小吉
io-uring-async-support
Avril 2 weeks ago
parent 9e5257507f
commit 2404721418
Signed by: flanchan
GPG Key ID: 284488987C31F630

10
Cargo.lock generated

@ -399,6 +399,7 @@ dependencies = [
"os_pipe",
"serde",
"serde_cbor",
"smallvec",
"tokio",
"tokio-uring",
"zstd",
@ -630,6 +631,15 @@ dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
dependencies = [
"serde",
]
[[package]]
name = "socket2"
version = "0.4.10"

@ -25,6 +25,8 @@ default = ["threads", "io_uring"]
threads = ["zstd/zstdmt", "dep:num_cpus"]
io_uring = ["dep:tokio-uring", "dep:async-compression", "dep:futures", "dep:tokio", "dep:os_pipe"]
unstable = ["smallvec/specialization", "smallvec/may_dangle"]
[dependencies]
async-compression = { version = "0.4.18", features = ["tokio", "zstd", "zstdmt"], optional = true }
bytes = { version = "1.10.0", features = ["serde"] }
@ -35,6 +37,7 @@ num_cpus = { version = "1.16.0", optional = true }
os_pipe = { version = "1.2.1", optional = true }
serde = { version = "1.0.217", features = ["derive"] }
serde_cbor = { version = "0.11.2", features = ["alloc"] }
smallvec = { version = "1.14.0", features = ["union", "const_generics", "const_new", "serde", "write"] }
tokio = { version = "1.43.0", features = ["io-util"], optional = true }
tokio-uring = { version = "0.5.0", optional = true, features = ["bytes"] }
zstd = { version = "0.13.2", features = [] }

@ -1,5 +1,6 @@
//#[macro_use] extern crate serde;
use smallvec::SmallVec;
use clap::{
Parser, Subcommand, ValueEnum,
};
@ -119,7 +120,7 @@ fn main() {
buffered_read_all_lines(&mut stdin, |string| {
chain.feed(&string.split_whitespace()
.filter(|word| !word.is_empty())
.map(|s| s.to_owned()).collect::<Vec<_>>());
.map(|s| s.to_owned()).collect::<SmallVec<[_; 16]>>());
Ok(())
}).expect("Failed to read from stdin");

Loading…
Cancel
Save