Skip to content

Commit

Permalink
Merge pull request #1168 from veryl-lang/bench_error
Browse files Browse the repository at this point in the history
Remove analyzer error from benchmark
  • Loading branch information
dalance authored Dec 26, 2024
2 parents 09e8dd6 + 5be9bb8 commit d50cbfe
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion crates/tests/benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ use veryl_parser::Parser;
#[cfg(target_os = "linux")]
mod perf;

const EXCLUDES: [&str; 2] = [r"52_include.veryl", r"67_cocotb.veryl"];
const EXCLUDES: [&str; 4] = [
r"25_dependency.veryl",
r"52_include.veryl",
r"67_cocotb.veryl",
r"68_std.veryl",
];

fn criterion_benchmark(c: &mut Criterion) {
let mut text = String::new();
Expand All @@ -23,6 +28,20 @@ fn criterion_benchmark(c: &mut Criterion) {
let metadata_path = Metadata::search_from_current().unwrap();
let metadata = Metadata::load(&metadata_path).unwrap();

// Check no analyzer error
let parser = Parser::parse(&text, &"").unwrap();
let prj = &metadata.project.name;
let analyzer = Analyzer::new(&metadata);
let mut errors = Vec::new();
errors.append(&mut analyzer.analyze_pass1(prj, &text, &"", &parser.veryl));
Analyzer::analyze_post_pass1();
errors.append(&mut analyzer.analyze_pass2(prj, &text, &"", &parser.veryl));
errors.append(&mut analyzer.analyze_pass3(prj, &text, &"", &parser.veryl));
if !errors.is_empty() {
dbg!(errors);
assert!(false);
}

let mut group = c.benchmark_group("throughput");
group.throughput(Throughput::Bytes(text.len() as u64));
group.bench_function("parse", |b| {
Expand Down

0 comments on commit d50cbfe

Please sign in to comment.