Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Disable 'Line length'. Doesn't provide much values
MD013: false
# Disable 'Fenced code blocks should have a language specified'
MD031: true
MD037: true
# Doesn't provide much in src/ to enforce it
MD040: false
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,19 @@ cargo build --release --target wasm32-wasip1 --no-default-features --features fe

To build SELinux-specific features, including `chcon` and `runcon`, ensure that `libselinux`
and `libclang` are installed on your system. Then, run the following command:

```
cargo build --release --features unix,feat_selinux
```

To speed up the checksum utilities (`md5sum`, `sha1sum`, `sha224sum`, `sha256sum`,
`sha384sum`, `sha512sum`, and `cksum`) by using OpenSSL's `libcrypto` instead of
the pure-Rust digest crates, enable the `openssl` feature:

```
cargo build --release --features unix,openssl
```

By default OpenSSL is built from source and statically linked into the
binary (mirroring how `expr` links `oniguruma`), so no runtime dependency
on system libcrypto/libssl is added. To link dynamically against the system
Expand All @@ -161,6 +164,7 @@ If you want to build the utilities as individual binaries, that is also possible
```shell
cargo build --release --bins --workspace --exclude coreutils --exclude uu_runcon --exclude uu_chcon
```

Each utility is contained in its own package within the main repository, named "uu_UTILNAME". To
build selected individual utilities, use the `--package` [aka `-p`] option. For example:

Expand Down Expand Up @@ -274,11 +278,13 @@ The `uudoc` binary generates completions for the `bash`, `elvish`,
`fish`, `powershell` and `zsh` shells to stdout.

Install `uudoc` by

```shell
cargo install --bin uudoc --features uudoc --path .
```

Then use the installed binary:

```shell
uudoc completion <utility> <shell>
```
Expand All @@ -291,6 +297,7 @@ uudoc completion ls bash > /usr/local/share/bash-completion/completions/ls.bash
```

Completion for prefixed `cp` with `uu-` on `zsh` is generated by

```shell
env PROG_PREFIX=uu- uudoc completion cp zsh
```
Expand Down
3 changes: 3 additions & 0 deletions docs/src/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ numbers. GNU coreutils uses `long double`, whose actual size may be [double prec
[quadruple precision 128-bit float](https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format) (e.g. arm64).

Practically, this means that printing a number with high precision will remain exact:

```
printf "%.48f\n" 0.1
0.100000000000000000000000000000000000000000000000 << uutils on all platforms
Expand Down Expand Up @@ -116,6 +117,7 @@ before the decimal point, 15 after).

Practically, this means that the default hexadecimal floating point output is
identical to x86(-64) GNU coreutils:

```
printf "%a\n" 0.1
0xc.ccccccccccccccdp-7 << uutils on all platforms
Expand All @@ -126,6 +128,7 @@ printf "%a\n" 0.1

We _can_ print an arbitrary number of digits if a larger precision is requested,
and the leading digit will still be in the `0x8`-`0xf` range:

```
printf "%.32a\n" 0.1
0xc.cccccccccccccccccccccccccccccccdp-7 << uutils on all platforms
Expand Down
5 changes: 5 additions & 0 deletions docs/src/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ samply record --rate 1000 ./target/debug/coreutils seq 1 1000
The output using the `debug` profile might be easier to understand, but the performance characteristics may be somewhat different from `release` profile that we _actually_ care about.

Consider using the `profiling` profile, that compiles in `release` mode but with debug symbols. For example:

```bash
cargo build --profile profiling -p uu_ls
samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null
Expand All @@ -124,20 +125,23 @@ samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null
## Workflow: Measuring Performance Improvements

1. **Establish baselines**:

```bash
hyperfine --warmup 3 \
"/usr/bin/sort large_file.txt" \
"our-sort-v1 large_file.txt"
```

2. **Identify bottlenecks**:

```bash
samply record ./our-sort-v1 large_file.txt
```

3. **Make targeted improvements** based on profiling data

4. **Verify improvements**:

```bash
hyperfine --warmup 3 \
"/usr/bin/sort large_file.txt" \
Expand All @@ -146,6 +150,7 @@ samply record -r 10000 target/profiling/ls -lR /var .git .git .git > /dev/null
```

5. **Document performance changes** with concrete numbers

```bash
hyperfine --export-markdown file.md [...]
```
1 change: 1 addition & 0 deletions docs/src/release-notes/0.0.13.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The highlights of this release are:
* Many improvements and fixes in many utils. In particular, `cp`, `dd`, `df`, `split` and `tr` have gotten very large improvements and are much more compatible with GNU.
* [Online user documentation](https://uutils.github.io/coreutils-docs/user/) featuring installation instructions, descriptions, flags, options and examples.
* We now use `clap` 3, which gives the `--help` output a new look and enables abbreviations of long arguments. For example:

```sh
ls --color # already worked pre 0.0.13
ls --col # any unambiguous shorthand now also works
Expand Down
2 changes: 1 addition & 1 deletion docs/src/release-notes/0.0.23.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ For more details, visit [https://github.com/uutils/coreutils-tracking/](https://
### mv
* mv: make UpdateMode public by @dmatos2012 in https://github.com/uutils/coreutils/pull/5428
* mv: Fix stderr output mv file into dir and dir into file where both are files by @mickvangelderen in https://github.com/uutils/coreutils/pull/5464
* mv: rename canonized_* -> canonicalized_* by @cakebaker in https://github.com/uutils/coreutils/pull/5454
* mv: rename `canonized_*` -> `canonicalized_*` by @cakebaker in https://github.com/uutils/coreutils/pull/5454
* mv: moving directory itself should fail by @dmatos2012 in https://github.com/uutils/coreutils/pull/5429

### pathchk
Expand Down
2 changes: 1 addition & 1 deletion docs/src/release-notes/0.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ We are excited to announce the release of **Rust Coreutils 0.5.0** — a signifi
* chore(deps): update rust crate clap to v4.5.52 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9316
* chore(deps): update rust crate clap_complete to v4.5.61 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9343
* chore(deps): update rust crate clap to v4.5.53 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9340
* GNUmakefile: Use libstdbuf.* instead of libstdbuf* by @oech3 in https://github.com/uutils/coreutils/pull/9345
* GNUmakefile: Use `libstdbuf.*` instead of `libstdbuf*` by @oech3 in https://github.com/uutils/coreutils/pull/9345
* chore(deps): update actions/checkout action to v6 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9416
* chore(deps): update rust crate parse_datetime to v0.13.3 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9434
* chore(deps): update rust crate hostname to v0.4.2 by @renovate[bot] in https://github.com/uutils/coreutils/pull/9515
Expand Down
1 change: 1 addition & 0 deletions src/uu/rm/BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ hyperfine --prepare "cp -r $test_dir tmp_d" "rm -rf tmp_d" "target/release/core
[samply](https://github.com/mstange/samply) is one option for simply creating flamegraphs. It uses the Firefox profiler as a UI.

To install:

```bash
cargo install samply
```
Expand Down
6 changes: 6 additions & 0 deletions src/uu/seq/BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ outputs (which is probably the most common use case for `seq`).

Specifying a format or fixed width will slow down the
execution a lot (~15-20 times on GNU `seq`):

```shell
hyperfine -L seq seq,target/release/seq "{seq} -f%g 1000000"
hyperfine -L seq seq,target/release/seq "{seq} -w 1000000"
```

Floating point increments, or any negative bound, also degrades the
performance (~10-15 times on GNU `seq`):

```shell
hyperfine -L seq seq,./target/release/seq "{seq} 0 0.000001 1"
hyperfine -L seq seq,./target/release/seq "{seq} -100 1 1000000"
Expand All @@ -49,6 +51,7 @@ as GNU `seq` may not provide the same precision (`uutils` version of
`seq` provides arbitrary precision, while GNU `seq` appears to be
limited to `long double` on the given platform, i.e. 64/80/128-bit
float):

```shell
hyperfine -L seq seq,target/release/seq "{seq} -f%.30f 0 0.000001 1"
```
Expand All @@ -66,10 +69,13 @@ performance compared with GNU `seq`.
### Directly print strings

As expected, directly printing a string:

```rust
stdout.write_all(separator.as_bytes())?
```

is quite a bit faster than using format to do the same operation:

```rust
write!(stdout, "{separator}")?
```
Expand Down
3 changes: 3 additions & 0 deletions src/uu/sort/BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ Run `cargo build --release` before benchmarking after you make a change!
## Sorting numbers

- Generate a list of numbers:

```
shuf -i 1-1000000 -n 1000000 > shuffled_numbers.txt
# or
seq 1 1000000 | sort -R > shuffled_numbers.txt
```

- Benchmark numeric sorting with hyperfine

```
hyperfine --warmup 3 \
'/tmp/gnu-sort -n /tmp/shuffled_numbers.txt'
Expand Down
Loading