Skip to content

Commit 9086f43

Browse files
authored
perf (tsort) : avoid reading the whole input into memory and intern strings (#9872)
* perf(tsort): avoid reading the whole input into memory and intern strings * perf(tsort): avoid redundant check on input * perf(tsort): switch to the Bucket interning Backend for better lookup performance
2 parents 6ac9543 + 4420344 commit 9086f43

File tree

4 files changed

+249
-153
lines changed

4 files changed

+249
-153
lines changed

Cargo.lock

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coreutils (uutils)
22
# * see the repository LICENSE, README, and CONTRIBUTING files for more information
33

4-
# spell-checker:ignore (libs) bigdecimal datetime serde bincode gethostid kqueue libselinux mangen memmap uuhelp startswith constness expl unnested logind cfgs
4+
# spell-checker:ignore (libs) bigdecimal datetime serde bincode gethostid kqueue libselinux mangen memmap uuhelp startswith constness expl unnested logind cfgs interner
55

66
[package]
77
name = "coreutils"
@@ -369,6 +369,7 @@ same-file = "1.0.6"
369369
self_cell = "1.0.4"
370370
# FIXME we use the exact version because the new 0.5.3 requires an MSRV of 1.88
371371
selinux = "=0.5.2"
372+
string-interner = "0.19.0"
372373
signal-hook = "0.4.1"
373374
tempfile = "3.15.0"
374375
terminal_size = "0.4.0"

src/uu/tsort/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#spell-checker:ignore (libs) interner
12
[package]
23
name = "uu_tsort"
34
description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs"
@@ -19,9 +20,11 @@ path = "src/tsort.rs"
1920

2021
[dependencies]
2122
clap = { workspace = true }
23+
fluent = { workspace = true }
24+
string-interner = { workspace = true }
2225
thiserror = { workspace = true }
26+
nix = { workspace = true, features = ["fs"] }
2327
uucore = { workspace = true }
24-
fluent = { workspace = true }
2528

2629
[[bin]]
2730
name = "tsort"

0 commit comments

Comments
 (0)