Skip to content

dd: simplify match - #13628

Open
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:dd-match
Open

dd: simplify match#13628
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:dd-match

Conversation

@oech3

@oech3 oech3 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/uu/dd/src/dd.rs
Comment thread src/uu/dd/src/dd.rs
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)
Skip an intermittent issue tests/tail/tail-n0f (was skipped on 'main', now failing)

@codspeed-hq

codspeed-hq Bot commented Jul 29, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 24.65%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 317 untouched benchmarks
⏩ 73 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation df_with_path 305.3 µs 244.9 µs +24.65%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing oech3:dd-match (62ab25c) with main (197eac4)

Open in CodSpeed

Footnotes

  1. 73 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Comment thread src/uu/dd/src/dd.rs
Comment on lines +1282 to 1289
if let t @ (ALARM_TRIGGER_TIMER | ALARM_TRIGGER_SIGNAL) = alarm.get_trigger() {
let tp = match t {
ALARM_TRIGGER_TIMER => ProgUpdateType::Periodic,
_ => ProgUpdateType::Signal,
};
let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), tp);
prog_tx.send(prog_update).unwrap_or(());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be cleaner to use continue in the _ arm? Something like:

        let tp = match alarm.get_trigger() {
            ALARM_TRIGGER_TIMER => ProgUpdateType::Periodic,
            ALARM_TRIGGER_SIGNAL => ProgUpdateType::Signal,
            _ => continue,
        };
        let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), tp);
        prog_tx.send(prog_update).unwrap_or(());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative:

        let update_type = match alarm.get_trigger() {
            ALARM_TRIGGER_TIMER => Some(ProgUpdateType::Periodic),
            ALARM_TRIGGER_SIGNAL => Some(ProgUpdateType::Signal),
            _ => None,
        };
        if let Some(tp) = update_type {
            let prog_update = ProgUpdate::new(rstat, wstat, start.elapsed(), tp);
            prog_tx.send(prog_update).unwrap_or(());
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants