Skip to content

Commit 9a94722

Browse files
committed
Drop release-fast profile for simplicity
1 parent 61dd826 commit 9a94722

File tree

5 files changed

+29
-33
lines changed

5 files changed

+29
-33
lines changed

.github/workflows/CICD.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ jobs:
321321
disable_search: true
322322
flags: makefile,${{ matrix.job.os }}
323323
fail_ci_if_error: false
324-
- name: "`make install PROG_PREFIX=uu- PROFILE=release-fast COMPLETIONS=n MANPAGES=n LOCALES=n`"
324+
- name: "`make install PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n`"
325325
shell: bash
326326
run: |
327327
set -x
328-
DESTDIR=/tmp/ make install PROG_PREFIX=uu- PROFILE=release-fast COMPLETIONS=n MANPAGES=n LOCALES=n
328+
DESTDIR=/tmp/ make install PROG_PREFIX=uu- PROFILE=release-small COMPLETIONS=n MANPAGES=n LOCALES=n
329329
# Check that utils are built with given profile
330-
./target/release-fast/true
330+
./target/release-small/true
331331
# Check that the progs have prefix
332332
test -f /tmp/usr/local/bin/uu-tty
333333
test -f /tmp/usr/local/libexec/uu-coreutils/libstdbuf.*
@@ -497,10 +497,10 @@ jobs:
497497
- uses: Swatinem/rust-cache@v2
498498
- name: Run sccache-cache
499499
uses: mozilla-actions/sccache-action@v0.0.9
500-
- name: "`make install PROFILE=release-fast`"
500+
- name: "`make install PROFILE=release`"
501501
shell: bash
502502
run: |
503-
export CARGO_TARGET_DIR=cargo-target RUSTFLAGS="${RUSTFLAGS} -C strip=symbols" PROFILE=release-fast MANPAGES=n COMPLETIONS=n LOCALES=n
503+
export CARGO_TARGET_DIR=cargo-target RUSTFLAGS="${RUSTFLAGS} -C strip=symbols" PROFILE=release MANPAGES=n COMPLETIONS=n LOCALES=n
504504
mkdir -p "${CARGO_TARGET_DIR}" && sudo mount -t tmpfs -o noatime,size=16G tmpfs "${CARGO_TARGET_DIR}"
505505
make install DESTDIR=target/size-release/
506506
make install COMPLETIONS=n MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/

Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -589,18 +589,14 @@ name = "uudoc"
589589
path = "src/bin/uudoc.rs"
590590
required-features = ["uudoc"]
591591

592-
# The default release profile with some optimizations.
593592
[profile.release]
594593
lto = true
595594
panic = "abort"
596-
597-
[profile.release-fast]
598-
inherits = "release"
599595
codegen-units = 1
600596

601597
# A release-like profile that is as small as possible.
602598
[profile.release-small]
603-
inherits = "release-fast"
599+
inherits = "release"
604600
opt-level = "z"
605601
strip = true
606602

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ other Rust program:
102102
cargo build --release
103103
```
104104

105-
Replace `--release` with `--profile=release-fast` or `--profile=release-small` to use all optimizations or save binary size.
105+
Replace `--release` with `--profile=release-small` to optimize binary size.
106106

107107
This command builds the most portable common core set of uutils into a multicall
108108
(BusyBox-type) binary, named 'coreutils', on most Rust-supported platforms.
@@ -155,10 +155,10 @@ To simply build all available utilities (with debug profile):
155155
make
156156
```
157157

158-
In release-fast mode:
158+
In release mode:
159159

160160
```shell
161-
make PROFILE=release-fast
161+
make PROFILE=release
162162
```
163163

164164
To build all but a few of the available utilities:
@@ -192,18 +192,12 @@ manpages or shell completion to work, use `GNU Make` or see
192192

193193
### Install with GNU Make
194194

195-
To install all available utilities:
195+
To install all available utilities (PROFILE=release by default):
196196

197197
```shell
198198
make install
199199
```
200200

201-
To install all utilities with all possible optimizations:
202-
203-
```shell
204-
make PROFILE=release-fast install
205-
```
206-
207201
To install using `sudo` switch `-E` must be used:
208202

209203
```shell

docs/src/packaging.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,10 @@ view the full documentation in the
5555
We provide three release profiles out of the box, though you may want to tweak
5656
them:
5757

58-
- `release`: This is the standard Rust release profile, but with link-time
59-
optimization enabled. It is a balance between compile time, performance and a
60-
reasonable amount of debug info. The main drawback of this profile is that the
61-
binary is quite large (roughly 2x the GNU coreutils).
62-
- `release-fast`: Every setting is tuned for the best performance, at the cost
63-
of compile time. This binary is still quite large.
64-
- `release-small`: Generates the smallest binary possible. This strips _all_
65-
debug info from the binary, resulting in less informative backtraces. The performance of
66-
this profile is also really good as it is close to the `release-fast` profile,
67-
but with all debuginfo stripped.
58+
- `release`: The profile with all performance optimization enabled.
59+
- `release-small`: Optimize binary size.
6860

61+
They include panic abort which removes stack traces on old rust [https://blog.rust-lang.org/2025/12/11/Rust-1.92.0/].
6962
For the precise definition of these profiles, you can look at the root
7063
[`Cargo.toml`](https://github.com/uutils/coreutils/blob/main/Cargo.toml).
7164

src/uu/shuf/src/shuf.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ impl Writable for &OsStr {
378378
}
379379

380380
impl Writable for u64 {
381+
#[inline]
381382
fn write_all_to(&self, output: &mut impl OsWrite) -> Result<(), Error> {
382383
// The itoa crate is surprisingly much more efficient than a formatted write.
383384
// It speeds up `shuf -r -n1000000 -i1-1024` by 1.8×.
@@ -386,6 +387,15 @@ impl Writable for u64 {
386387
}
387388
}
388389

390+
#[cold]
391+
#[inline(never)]
392+
fn crash(e: std::io::Error) -> Box<dyn uucore::error::UError> {
393+
use uucore::error::FromIo;
394+
let ctx = translate!("shuf-error-write-failed");
395+
e.map_err_context(move || ctx)
396+
}
397+
398+
#[inline(never)]
389399
fn shuf_exec(
390400
input: &mut impl Shufable,
391401
opts: &Options,
@@ -402,9 +412,12 @@ fn shuf_exec(
402412
}
403413
for _ in 0..opts.head_count {
404414
let r = input.choose(rng)?;
405-
406-
r.write_all_to(output).map_err_context(ctx)?;
407-
output.write_all(&[opts.sep]).map_err_context(ctx)?;
415+
if let Err(e) = r.write_all_to(output) {
416+
return Err(crash(e));
417+
}
418+
if let Err(e) = output.write_all(&[opts.sep]) {
419+
return Err(crash(e));
420+
}
408421
}
409422
} else {
410423
let shuffled = input.partial_shuffle(rng, opts.head_count)?;

0 commit comments

Comments
 (0)