Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions core/tests/vm-benchmark/benches/criterion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ use criterion::{
use zksync_types::Transaction;
use zksync_vm_benchmark_harness::{
cut_to_allowed_bytecode_size, get_deploy_tx, get_heavy_load_test_tx, get_load_test_deploy_tx,
get_load_test_tx, get_realistic_load_test_tx, BenchmarkingVm, BenchmarkingVmFactory, Fast, Lambda,
Legacy, LoadTestParams,
get_load_test_tx, get_realistic_load_test_tx, BenchmarkingVm, BenchmarkingVmFactory, Fast,
Lambda, Legacy, LoadTestParams,
};

const SAMPLE_SIZE: usize = 20;
const ZKSYNC_HOME: &str = std::env!("ZKSYNC_HOME");

fn benches_in_folder<VM: BenchmarkingVmFactory, const FULL: bool>(c: &mut Criterion) {
let mut group = c.benchmark_group(VM::LABEL.as_str());
group
.sample_size(SAMPLE_SIZE)
.measurement_time(Duration::from_secs(10));

for path in std::fs::read_dir("deployment_benchmarks").unwrap() {
let bench_path = format!(
"{}/core/tests/vm-benchmark/deployment_benchmarks",
ZKSYNC_HOME
);

for path in std::fs::read_dir(bench_path).unwrap() {
let path = path.unwrap().path();

let test_contract = std::fs::read(&path).expect("failed to read file");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pragma solidity ^0.8.0;

contract benchmark {
uint256 value;
constructor() {
value = fib(25);
}

function get_calculation() public view returns (uint256) {
return value;
}

function fib(uint256 n) internal returns (uint256) {
if (n <= 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma solidity >=0.8.20;

contract Send {
constructor() {
address payable self = payable(msg.sender);
self.call{value: 100};
}
}