image.domain\self_evolve\perf_types.mbt
75% · 3 / 4 points · 75 linesBackground color reports the state of each line. Underlined characters mark exact instrumented byte offsets; hover them to inspect the visit count.
- 1
///| - 2
/// # 性能类型 self_evolve/perf_types - 3
/// - 4
/// 图像处理库子模块 - 5
/// 图像处理库子模块 Image processing library submodule - 6
// 性能回归检测类型 — 静态成本模型 - 7
// Performance regression types: static cost model - 8
- 9
///| - 10
/// 算子成本估算。 - 11
/// 描述 Op cost estimate. - 12
#derive(Eq, @debug.Debug) - 13
pub(all) struct OpCost { - 14
op_tag : String - 15
time_complexity : String - 16
estimated_cost : Int32 - 17
} - 18
- 19
///| - 20
pub extend OpCost with @debug.Debug::{to_repr} - 21
- 22
///| - 23
pub extend OpCost with Eq::{not_equal, equal} - 24
- 25
///| - 26
/// 管道性能基线。 - 27
/// 管线 Pipeline performance baseline. - 28
#derive(Eq, @debug.Debug) - 29
pub(all) struct PerfBaseline { - 30
pipeline_desc : String - 31
total_cost : Int32 - 32
op_count : Int32 - 33
op_costs : Array[OpCost] - 34
} - 35
- 36
///| - 37
pub extend PerfBaseline with @debug.Debug::{to_repr} - 38
- 39
///| - 40
pub extend PerfBaseline with Eq::{not_equal, equal} - 41
- 42
///| - 43
/// 性能回归检测结果。 - 44
/// 性能 Performance regression result. - 45
#derive(Eq, @debug.Debug) - 46
pub(all) struct PerfRegression { - 47
original_cost : Int32 - 48
optimized_cost : Int32 - 49
delta : Int32 - 50
is_regression : Bool - 51
} - 52
- 53
///| - 54
pub extend PerfRegression with @debug.Debug::{to_repr} - 55
- 56
///| - 57
pub extend PerfRegression with Eq::{not_equal, equal} - 58
- 59
///| - 60
/// 优化是否改善性能。 - 61
/// 描述 Whether optimization improved performance. - 62
pub fn PerfRegression::is_improvement(self : PerfRegression) -> Bool { - 63●
self.delta < 0 - 64
} - 65
- 66
///| - 67
/// 改善百分比(0-100)。 - 68
/// 描述 Improvement percentage (0-100). - 69
pub fn PerfRegression::improvement_pct(self : PerfRegression) -> Int32 { - 70●
if self.original_cost == 0 { - 71○
0 - 72
} else { - 73●
self.delta * 100 / self.original_cost - 74
} - 75
}