dd: simplify match - #13628
Conversation
|
GNU testsuite comparison: |
Merging this PR will improve performance by 24.65%
|
| 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)
Footnotes
-
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. ↩
| 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(()); | ||
| } |
There was a problem hiding this comment.
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(());There was a problem hiding this comment.
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(());
}
No description provided.