Compare commits

..
Author SHA1 Message Date
David Peter b5f58651a1 Extract quantity and command helpers 2026-10-05 11:14:09 +02:00
David Peter ecf8a24b1e Merge pull request #962 from sharkdp/codex/quantity-module-layout
Group units, formatting, and statistics under quantity
2026-10-05 11:04:56 +02:00
David Peter 975a25ce44 Merge pull request #961 from sharkdp/codex/uom-quantities
Use uom quantities for benchmark measurements
2026-10-05 10:47:07 +02:00
David Peter 9cdb9c4c50 Merge pull request #840 from sharkdp/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 5 to 6
2026-10-05 10:30:51 +02:00
dependabot[bot] ba98c8c44b Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-21 11:07:22 +00:00
6 changed files with 24 additions and 16 deletions

No files matched your search

+4 -4
View File
@@ -18,7 +18,7 @@ jobs:
name: Extract crate metadata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Extract crate information
id: crate_metadata
run: |
@@ -49,7 +49,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- run: cargo fmt -- --check
min_version:
@@ -58,7 +58,7 @@ jobs:
needs: crate_metadata
steps:
- name: Checkout source code
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }})
uses: dtolnay/rust-toolchain@master
@@ -96,7 +96,7 @@ jobs:
BUILD_CMD: cargo
steps:
- name: Checkout source code
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Install prerequisites
shell: bash
+1 -1
View File
@@ -266,7 +266,7 @@ impl Executor for ShellExecutor<'_> {
time_wall_clock: measurements.time_wall_clock_mean(),
time_user: measurements.time_user_mean(),
time_system: measurements.time_system_mean(),
peak_memory_usage: Information::zero(),
peak_memory_usage: measurements.peak_memory_usage_mean(),
exit_status: ExitStatus::default(),
});
+6 -7
View File
@@ -1,7 +1,7 @@
use std::process::ExitStatus;
use crate::quantity::statistics::{max, mean, median, min, modified_zscores, standard_deviation};
use crate::quantity::{second, Information, Time};
use crate::quantity::{Information, Time};
/// Performance measurements and exit status from running a single command
#[derive(Debug, Default, Copy, Clone)]
@@ -77,12 +77,7 @@ impl Measurements {
/// Compute modified Z-scores for the wall clock times.
pub fn modified_zscores(&self) -> Vec<f64> {
modified_zscores(
&self
.wall_clock_times()
.map(|t| t.get::<second>())
.collect::<Vec<_>>(),
)
modified_zscores(&self.wall_clock_times().collect::<Vec<_>>())
}
/// The average user time.
@@ -94,4 +89,8 @@ impl Measurements {
pub fn time_system_mean(&self) -> Time {
mean(self.measurements.iter().map(|m| m.time_system))
}
pub fn peak_memory_usage_mean(&self) -> Information {
mean(self.measurements.iter().map(|m| m.peak_memory_usage))
}
}
+5 -1
View File
@@ -97,10 +97,14 @@ impl<'a> Command<'a> {
&self.parameters
}
pub fn is_parameter_unused(&self, parameter: &str) -> bool {
!self.expression.contains(&format!("{{{parameter}}}"))
}
pub fn get_unused_parameters(&self) -> impl Iterator<Item = &(&'a str, ParameterValue)> {
self.parameters
.iter()
.filter(move |(parameter, _)| !self.expression.contains(&format!("{{{parameter}}}")))
.filter(move |(parameter, _)| self.is_parameter_unused(parameter))
}
fn replace_parameters_in(&self, original: &str) -> String {
+2 -2
View File
@@ -14,13 +14,13 @@ pub const OUTLIER_THRESHOLD: f64 = 1.4826 * 10.0;
/// modified Z-score that is larger than `OUTLIER_THRESHOLD`.
#[cfg(test)]
pub fn num_outliers(xs: &[f64]) -> usize {
use crate::quantity::statistics::modified_zscores;
use crate::quantity::statistics::modified_zscores_f64;
if xs.is_empty() {
return 0;
}
let scores = modified_zscores(xs);
let scores = modified_zscores_f64(xs);
scores
.iter()
.filter(|&&s| s.abs() > OUTLIER_THRESHOLD)
+6 -1
View File
@@ -112,7 +112,7 @@ pub fn standard_deviation<Q: UnsafeRawValue>(values: &[Q], mean: Q) -> Q {
///
/// References:
/// - <https://en.wikipedia.org/wiki/Median_absolute_deviation>
pub fn modified_zscores(xs: &[f64]) -> Vec<f64> {
pub fn modified_zscores_f64(xs: &[f64]) -> Vec<f64> {
assert!(!xs.is_empty());
// Compute sample median:
@@ -131,6 +131,11 @@ pub fn modified_zscores(xs: &[f64]) -> Vec<f64> {
xs.iter().map(|&x| (x - x_median) / mad).collect()
}
pub fn modified_zscores<Q: UnsafeRawValue>(values: &[Q]) -> Vec<f64> {
let values: Vec<_> = values.iter().map(|q| q.unsafe_raw_value()).collect();
modified_zscores_f64(&values)
}
#[cfg(test)]
mod tests {
use super::*;