Skip to content

Commit

Permalink
update layout all
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrigada committed Mar 3, 2023
1 parent aba5676 commit 72eed98
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ let program =
```rust
let mut vm = VirtualMachine::new(false);

let mut cairo_runner = CairoRunner::new(&program, "all", false);
let mut cairo_runner = CairoRunner::new(&program, "all_cairo", false);

let mut hint_processor = BuiltinHintProcessor::new_empty();

Expand Down
2 changes: 1 addition & 1 deletion bench/criterion_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const BENCH_PATH: &str = "cairo_programs/benchmarks/";
pub fn criterion_benchmarks(c: &mut Criterion) {
let mut hint_executor = BuiltinHintProcessor::new_empty();
let cairo_run_config = cairo_vm::cairo_run::CairoRunConfig {
layout: "all",
layout: "all_cairo",
..cairo_vm::cairo_run::CairoRunConfig::default()
};
for benchmark_name in build_bench_strings() {
Expand Down
2 changes: 1 addition & 1 deletion bench/iai_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro_rules! iai_bench_expand_prog {
($val: ident) => {
fn $val() -> Result<CairoRunner, CairoRunError> {
let cairo_run_config = cairo_vm::cairo_run::CairoRunConfig {
layout: "all",
layout: "all_cairo",
..cairo_vm::cairo_run::CairoRunConfig::default()
};
let mut hint_executor = BuiltinHintProcessor::new_empty();
Expand Down
32 changes: 27 additions & 5 deletions bench/run_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
#!/usr/bin/env sh
tests_path="../cairo_programs/benchmarks"
tests_path="cairo_programs/benchmarks"
trace_enabled=${1:-false}

set -e

source ../cairo-rs-py/scripts/cairo-rs-py/bin/activate

for input_file in "$tests_path"/*.cairo; do
if [ -f "$input_file" ]; then
output_file="${input_file%.cairo}.json"
cairo-compile --cairo_path="cairo_programs" "$input_file" --output "$output_file"
echo "Compiled $input_file to $output_file"
fi
done

deactivate

for file in $(ls $tests_path | grep .cairo | sed -E 's/\.cairo//'); do
echo "Running $file benchmark"

export PATH="$(pyenv root)/shims:$PATH"

hyperfine \
-n "Cairo VM (CPython)" "PYENV_VERSION=3.7.12 cairo-run --layout all --program $tests_path/$file.json" \
-n "Cairo VM (PyPy)" "PYENV_VERSION=pypy3.7-7.3.9 cairo-run --layout all --program $tests_path/$file.json" \
-n "cairo-rs (Rust)" "../target/release/cairo-rs-run $tests_path/$file.json --layout all"
if [ "$trace_enabled" = true ]; then
hyperfine -w 0 -r 2 -i --show-output \
-n "Cairo VM (CPython)" "source ../cairo-rs-py/scripts/cairo-lang/bin/activate && cairo-run --layout all --program $tests_path/$file.json --trace_file $tests_path/$file.trace" \
-n "Cairo VM (PyPy)" "source ../cairo-rs-py/scripts/cairo-rs-pypy/bin/activate && cairo-run --layout all --program $tests_path/$file.json --trace_file $tests_path/$file.trace" \
-n "cairo-rs (Rust)" "target/release/cairo-rs-run $tests_path/$file.json --layout all --trace_file $tests_path/$file.trace"
else
hyperfine -w 0 -r 2 -i --show-output \
-n "Cairo VM (CPython)" "source ../cairo-rs-py/scripts/cairo-lang/bin/activate && cairo-run --layout all --program $tests_path/$file.json" \
-n "Cairo VM (PyPy)" "source ../cairo-rs-py/scripts/cairo-rs-pypy/bin/activate && cairo-run --layout all --program $tests_path/$file.json" \
-n "cairo-rs (Rust)" "target/release/cairo-rs-run $tests_path/$file.json --layout all"
fi
done


1 comment on commit 72eed98

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: 72eed98 Previous: d5a7bea Ratio
cairo_run(cairo_programs/benchmarks/compare_arrays_200000.json) 829489525 ns/iter (± 50680745) 637231489 ns/iter (± 1969874) 1.30
cairo_run(cairo_programs/benchmarks/keccak_integration_benchmark.json) 1729917678 ns/iter (± 83291756) 1240800087 ns/iter (± 8607617) 1.39
cairo_run(cairo_programs/benchmarks/secp_integration_benchmark.json) 1916670920 ns/iter (± 25576369) 1348564409 ns/iter (± 2660517) 1.42
cairo_run(cairo_programs/benchmarks/blake2s_integration_benchmark.json) 1520645618 ns/iter (± 40201880) 1082080349 ns/iter (± 8505744) 1.41

This comment was automatically generated by workflow using github-action-benchmark.

CC: @unbalancedparentheses

Please sign in to comment.