MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / samples_result

Function samples_result

xtask/src/main.rs:4304–4336  ·  view source on GitHub ↗
(
    id: &'static str,
    label: String,
    unit: &'static str,
    operation_count: usize,
    samples: Vec<u128>,
)

Source from the content-addressed store, hash-verified

4302}
4303
4304fn samples_result(
4305 id: &'static str,
4306 label: String,
4307 unit: &'static str,
4308 operation_count: usize,
4309 samples: Vec<u128>,
4310) -> BenchmarkTestResult {
4311 let elapsed_micros = samples.iter().sum();
4312 let mut sorted = samples;
4313 sorted.sort_unstable();
4314 let trim = if sorted.len() >= 10 {
4315 sorted.len() / 10
4316 } else {
4317 0
4318 };
4319 let trimmed = &sorted[trim..sorted.len() - trim];
4320 let average = trimmed.iter().sum::<u128>() as f64 / trimmed.len() as f64;
4321 let p50 = percentile_sorted(&sorted, 0.50);
4322 let p95 = percentile_sorted(&sorted, 0.95);
4323 BenchmarkTestResult {
4324 id,
4325 label,
4326 unit,
4327 operation_count,
4328 sample_count: sorted.len(),
4329 trimmed_sample_count: trimmed.len(),
4330 elapsed_micros,
4331 average_micros: Some(average),
4332 min_micros: sorted.first().copied(),
4333 p50_micros: p50,
4334 p95_micros: p95,
4335 }
4336}
4337
4338fn single_sample_result(
4339 id: &'static str,

Calls 3

percentile_sortedFunction · 0.85
iterMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected