Skip to content
Myr

[update patch]

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by William Chargin · committed by David Peter · parent a8a75a3 · Browse files · 2 files+7 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • wchargin-branch: param-list-matrix
  • wchargin-source: f866f0df2eae5f4bac2022c0db48edb0e8e6361e

Diff stats

2 files+7 added−7 removed

  • other:+7 added−7 removed

2 files+7 added−7 removed

modified:scripts/plot_parametrized.py+4 added-4 removed
48 unmodified lines
49 die(50 "benchmarks must all have the same parameter name, but found: %s"51 % sorted(names)52 )53 return (next(iter(names)), values)53 return (next(iter(names)), list(values))545556def unique_parameter(benchmark):57 """Return the unique parameter `(name: str, value: float)`, or dies."""57 """Return the unique parameter `(name: str, value: float)`, or die."""58 params_dict = benchmark.get("parameters", {})59 if not params_dict:60 die("benchmarks must have exactly one parameter, but found none")61 if len(params_dict) > 1:62 die(63 "benchmarks must have exactly one parameter, but found multiple: %s"64 % sorted(params_dict)65 )66 return next(iter(params_dict.items()))66 [(name, value)] = params_dict.items()67 return (name, float(value))686970parameter_name = None71
8 unmodified lines
80 % (parameter_name, this_parameter_name)81 )82 parameter_name = this_parameter_name8383 parameter_values = [float(pv) for pv in parameter_values]84 times_mean = [b["mean"] for b in results]85 times_stddev = [b["stddev"] for b in results]8687 plt.errorbar(x=parameter_values, y=times_mean, yerr=times_stddev, capsize=2)
16 unmodified lines
modified:src/hyperfine/export/csv.rs+3 added-3 removed
14 unmodified lines
15 fn serialize(&self, results: &[BenchmarkResult], _unit: Option<Unit>) -> Result<Vec<u8>> {16 let mut writer = WriterBuilder::new().from_writer(vec![]);1718 {19 let mut headers: Vec<String> = [19 let mut headers: Vec<Cow<[u8]>> = [20 // The list of times cannot be exported to the CSV file - omit it.21 "command", "mean", "stddev", "median", "user", "system", "min", "max",22 ]23 .iter()24 .map(|x| (*x).to_string())24 .map(|x| Cow::Borrowed(x.as_bytes()))25 .collect();26 if let Some(res) = results.first() {27 for param_name in res.parameters.keys() {28 headers.push(format!("parameter_{}", param_name));28 headers.push(Cow::Owned(format!("parameter_{}", param_name).into_bytes()));29 }30 }31 writer.write_record(headers)?;32 }
74 unmodified lines