Skip to content

Commit c28c602

Browse files
committed
wip
1 parent 9214337 commit c28c602

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

module/move/benchkit/src/analysis.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ use std::collections::HashMap;
1010
pub struct ComparativeAnalysis {
1111
name: String,
1212
variants: HashMap<String, Box<dyn FnMut() + Send>>,
13-
results: HashMap<String, BenchmarkResult>,
13+
}
14+
15+
impl std::fmt::Debug for ComparativeAnalysis {
16+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17+
f.debug_struct("ComparativeAnalysis")
18+
.field("name", &self.name)
19+
.field("variants", &format!("{} variants", self.variants.len()))
20+
.finish()
21+
}
1422
}
1523

1624
impl ComparativeAnalysis {
@@ -19,7 +27,6 @@ impl ComparativeAnalysis {
1927
Self {
2028
name: name.into(),
2129
variants: HashMap::new(),
22-
results: HashMap::new(),
2330
}
2431
}
2532

@@ -59,7 +66,9 @@ impl ComparativeAnalysis {
5966
/// Report containing results of comparative analysis
6067
#[derive(Debug)]
6168
pub struct ComparisonReport {
69+
/// Name of the comparison analysis
6270
pub name: String,
71+
/// Results of each algorithm variant tested
6372
pub results: HashMap<String, BenchmarkResult>,
6473
}
6574

@@ -166,7 +175,9 @@ impl ComparisonReport {
166175
/// Performance regression analysis
167176
#[derive(Debug, Clone)]
168177
pub struct RegressionAnalysis {
178+
/// Baseline benchmark results to compare against
169179
pub baseline_results: HashMap<String, BenchmarkResult>,
180+
/// Current benchmark results being analyzed
170181
pub current_results: HashMap<String, BenchmarkResult>,
171182
}
172183

module/move/benchkit/src/generators.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ pub fn generate_urls(size: DataSize) -> Vec<String> {
133133
}
134134

135135
/// Seeded random data generator using simple LCG
136+
#[derive(Debug)]
136137
pub struct SeededGenerator {
137138
seed: u64,
138139
}
@@ -183,6 +184,7 @@ pub fn generate_random_vec(size: usize) -> Vec<i32> {
183184
}
184185

185186
/// Generate test data for common parsing scenarios (based on unilang experience)
187+
#[derive(Debug)]
186188
pub struct ParsingTestData;
187189

188190
impl ParsingTestData {

module/move/benchkit/src/measurement.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,11 @@ impl fmt::Display for BenchmarkResult {
122122
/// Comparison between two benchmark results
123123
#[derive(Debug, Clone)]
124124
pub struct Comparison {
125+
/// The baseline benchmark result to compare against
125126
pub baseline: BenchmarkResult,
127+
/// The current benchmark result being compared
126128
pub current: BenchmarkResult,
129+
/// Improvement percentage (positive means current is faster than baseline)
127130
pub improvement_percentage: f64,
128131
}
129132

module/move/benchkit/src/reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl ReportGenerator {
190190

191191
// Performance tiers
192192
let fastest = sorted_results.first().unwrap().1;
193-
let slowest = sorted_results.last().unwrap().1;
193+
let _slowest = sorted_results.last().unwrap().1;
194194
let median_idx = sorted_results.len() / 2;
195195
let median = sorted_results[median_idx].1;
196196

module/move/benchkit/src/suite.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,24 @@ use std::collections::HashMap;
99

1010
/// A collection of benchmarks that can be run together
1111
pub struct BenchmarkSuite {
12+
/// Name of the benchmark suite
1213
pub name: String,
1314
benchmarks: HashMap<String, Box<dyn FnMut() + Send>>,
1415
config: MeasurementConfig,
1516
results: HashMap<String, BenchmarkResult>,
1617
}
1718

19+
impl std::fmt::Debug for BenchmarkSuite {
20+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21+
f.debug_struct("BenchmarkSuite")
22+
.field("name", &self.name)
23+
.field("benchmarks", &format!("{} benchmarks", self.benchmarks.len()))
24+
.field("config", &self.config)
25+
.field("results", &format!("{} results", self.results.len()))
26+
.finish()
27+
}
28+
}
29+
1830
impl BenchmarkSuite {
1931
/// Create a new benchmark suite
2032
pub fn new(name: impl Into<String>) -> Self {
@@ -103,7 +115,9 @@ impl BenchmarkSuite {
103115
/// Results from running a benchmark suite
104116
#[derive(Debug)]
105117
pub struct SuiteResults {
118+
/// Name of the benchmark suite that was run
106119
pub suite_name: String,
120+
/// Individual benchmark results from the suite
107121
pub results: HashMap<String, BenchmarkResult>,
108122
}
109123

0 commit comments

Comments
 (0)