Skip to content

Commit

Permalink
Adding slow example to bencher iai
Browse files Browse the repository at this point in the history
  • Loading branch information
beta-ziliani committed Jan 13, 2025
1 parent 1565d8d commit 454c5da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion crates/solidity/testing/perf/benches/iai/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use iai_callgrind::{
use solidity_testing_perf::dataset::SourceFile;
use solidity_testing_perf::tests::bindings_resolve::BuiltBindingGraph;
use solidity_testing_perf::tests::parser::ParsedFile;
use solidity_testing_perf::tests::slow::SlowPayload;

mod __dependencies_used_in_lib__ {
use {infra_utils as _, metaslang_bindings as _, semver as _, slang_solidity as _};
Expand All @@ -36,12 +37,13 @@ define_payload_benchmark!(cursor, Vec<ParsedFile>);
define_payload_benchmark!(query, Vec<ParsedFile>);
define_payload_benchmark!(bindings_build, Vec<ParsedFile>);
define_payload_benchmark!(bindings_resolve, BuiltBindingGraph);
define_payload_benchmark!(slow, SlowPayload);

library_benchmark_group!(
name = benchmarks;

// __SLANG_INFRA_BENCHMARKS_LIST__ (keep in sync)
benchmarks = parser, cursor, query, bindings_build, bindings_resolve,
benchmarks = parser, cursor, query, bindings_build, bindings_resolve, slow,
);

main!(
Expand Down
6 changes: 4 additions & 2 deletions crates/solidity/testing/perf/src/tests/slow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ use slang_solidity::cst::{Cursor, TerminalKind};

pub const SOLC_VERSION: Version = Version::new(0, 7, 1);

pub type SlowPayload = (Cursor, Rc<BindingGraph>);

const SOURCE: &str = "pools/weighted/WeightedPool.sol";

const BASE_PATH: &str = "crates/solidity/outputs/npm/tests/src/compilation/inputs/0x01abc00E86C7e258823b9a055Fd62cA6CF61a163/sources/contracts";
Expand Down Expand Up @@ -49,7 +51,7 @@ fn add_file(seen_files: &mut Vec<String>, builder: &mut InternalCompilationBuild
}
}

pub fn setup() -> (Cursor, Rc<BindingGraph>) {
pub fn setup() -> SlowPayload {
let mut builder =
InternalCompilationBuilder::create(SOLC_VERSION).expect("Can't create CompilationBuilder");

Expand All @@ -72,7 +74,7 @@ pub fn setup() -> (Cursor, Rc<BindingGraph>) {
}
}

pub fn run(data: (Cursor, Rc<BindingGraph>)) {
pub fn run(data: SlowPayload) {
let (mut cursor, binding_graph) = data;

let mut ambiguous_refs = 0;
Expand Down

0 comments on commit 454c5da

Please sign in to comment.