Skip to content

Commit a63544b

Browse files
hyperpolymathclaude
andcommitted
fix(bench): repair scan_bench for drifted types (stale since ~v2.5.0)
Benches wouldn't compile — types had drifted unchecked: - TaintAnalyzer lost ::new() (now static-method API); rewrote bench_taint_analysis to exercise query_flows against an empty FactDB - WeakPoint gained `suppressed` field; fixture updated - ProgramStatistics renamed/reshaped: expect_calls removed, panic_paths -> panic_sites, added allocation_sites + io_operations Headline numbers on this machine: - assail_self_scan: ~55ms full scan of own src/ tree - language_detect: ~47 ns/file - rule_eval dispatch: ~4 ns - taint_query_flows (empty DB): ~18 ns Dogfood lesson: tree doesn't fail the build when the bench harness rots. Worth a CI gate that runs `cargo bench --no-run` — deferred, not in this commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6ffc1d7 commit a63544b

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

benches/scan_bench.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,13 @@ fn bench_self_scan(c: &mut Criterion) {
8383

8484
/// Benchmark taint analysis engine
8585
fn bench_taint_analysis(c: &mut Criterion) {
86+
use panic_attack::kanren::core::FactDB;
8687
use panic_attack::kanren::taint::TaintAnalyzer;
8788

88-
c.bench_function("taint_sources_iteration", |b| {
89-
let analyzer = TaintAnalyzer::new();
89+
c.bench_function("taint_query_flows_empty", |b| {
90+
let db = FactDB::new();
9091
b.iter(|| {
91-
let _sources = black_box(analyzer.sources());
92+
let _flows = black_box(TaintAnalyzer::query_flows(&db));
9293
})
9394
});
9495
}
@@ -122,6 +123,7 @@ fn bench_location_extraction(c: &mut Criterion) {
122123
line: None,
123124
description: "test".to_string(),
124125
recommended_attack: vec![],
126+
suppressed: false,
125127
};
126128
100
127129
];
@@ -140,18 +142,19 @@ fn bench_statistics_calculation(c: &mut Criterion) {
140142
c.bench_function("stats_field_access", |b| {
141143
let stats = panic_attack::types::ProgramStatistics {
142144
total_lines: 10000,
143-
unwrap_calls: 50,
144-
expect_calls: 20,
145145
unsafe_blocks: 5,
146+
panic_sites: 0,
147+
unwrap_calls: 50,
148+
allocation_sites: 12,
149+
io_operations: 4,
146150
threading_constructs: 3,
147-
panic_paths: 0,
148151
};
149152

150153
b.iter(|| {
151154
let _ = black_box(stats.total_lines);
152155
let _ = black_box(stats.unwrap_calls);
153-
let _ = black_box(stats.expect_calls);
154156
let _ = black_box(stats.unsafe_blocks);
157+
let _ = black_box(stats.panic_sites);
155158
})
156159
});
157160
}

0 commit comments

Comments
 (0)