Skip to content

Commit 3cb141d

Browse files
committed
Drop release-fast profile for simplicity
1 parent e1259d9 commit 3cb141d

File tree

5 files changed

+33
-35
lines changed

5 files changed

+33
-35
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
@@ -591,18 +591,14 @@ name = "uudoc"
591591
path = "src/bin/uudoc.rs"
592592
required-features = ["uudoc"]
593593

594-
# The default release profile with some optimizations.
595594
[profile.release]
596595
lto = true
597596
panic = "abort"
598-
599-
[profile.release-fast]
600-
inherits = "release"
601597
codegen-units = 1
602598

603599
# A release-like profile that is as small as possible.
604600
[profile.release-small]
605-
inherits = "release-fast"
601+
inherits = "release"
606602
opt-level = "z"
607603
strip = true
608604

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: 20 additions & 5 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,13 +387,23 @@ 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,
392402
rng: &mut WrappedRng,
393403
output: &mut BufWriter<Box<dyn OsWrite>>,
394404
) -> UResult<()> {
395405
let ctx = || translate!("shuf-error-write-failed");
406+
let sep = [opts.sep];
396407
if opts.repeat {
397408
if input.is_empty() {
398409
return Err(USimpleError::new(
@@ -402,17 +413,21 @@ fn shuf_exec(
402413
}
403414
for _ in 0..opts.head_count {
404415
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)?;
416+
if let Err(e) = r.write_all_to(output) {
417+
return Err(crash(e));
418+
}
419+
if let Err(e) = output.write_all(&sep) {
420+
return Err(crash(e));
421+
}
408422
}
409423
} else {
410424
let shuffled = input.partial_shuffle(rng, opts.head_count)?;
425+
let sep = [opts.sep];
411426

412427
for r in shuffled {
413428
let r = r?;
414-
r.write_all_to(output).map_err_context(ctx)?;
415-
output.write_all(&[opts.sep]).map_err_context(ctx)?;
429+
r.write_all_to(output).map_err(crash)?;
430+
output.write_all(&sep).map_err(crash)?;
416431
}
417432
}
418433
output.flush().map_err_context(ctx)?;

0 commit comments

Comments
 (0)