lambdaclass / cairo-vm

cairo-vm is a Rust implementation of the Cairo VM. Cairo (CPU Algebraic Intermediate Representation) is a programming language for writing provable programs, where one party can prove to another that a certain computation was executed correctly without the need for this party to re-execute the same program.
https://lambdaclass.github.io/cairo-vm
Apache License 2.0
508 stars 142 forks source link

Refactor cairo1-run crate #1601

Closed fmoletta closed 7 months ago

fmoletta commented 7 months ago

This PR consists of two refactors:

github-actions[bot] commented 7 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.271 ± 0.020 2.249 2.318 1.00
head big_factorial 2.285 ± 0.021 2.257 2.325 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.287 ± 0.014 2.269 2.311 1.01 ± 0.01
head big_fibonacci 2.255 ± 0.015 2.242 2.284 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.346 ± 0.208 8.208 8.890 1.00 ± 0.03
head blake2s_integration_benchmark 8.328 ± 0.089 8.194 8.412 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.297 ± 0.013 2.286 2.330 1.00
head compare_arrays_200000 2.304 ± 0.015 2.292 2.333 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.451 ± 0.007 1.444 1.462 1.00
head dict_integration_benchmark 1.476 ± 0.013 1.465 1.505 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.300 ± 0.009 1.287 1.313 1.00 ± 0.01
head field_arithmetic_get_square_benchmark 1.299 ± 0.007 1.291 1.316 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.381 ± 0.180 8.227 8.839 1.00
head integration_builtins 8.389 ± 0.196 8.248 8.882 1.00 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.576 ± 0.098 8.472 8.711 1.00
head keccak_integration_benchmark 8.602 ± 0.111 8.483 8.817 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.330 ± 0.014 2.318 2.368 1.00
head linear_search 2.353 ± 0.017 2.331 2.379 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.580 ± 0.010 1.573 1.599 1.00
head math_cmp_and_pow_integration_benchmark 1.606 ± 0.007 1.597 1.613 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.438 ± 0.007 1.431 1.454 1.00
head math_integration_benchmark 1.475 ± 0.006 1.463 1.482 1.03 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.263 ± 0.007 1.257 1.276 1.00
head memory_integration_benchmark 1.268 ± 0.014 1.256 1.302 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.604 ± 0.010 1.595 1.626 1.00
head operations_with_data_structures_benchmarks 1.645 ± 0.023 1.626 1.706 1.03 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 607.5 ± 3.1 604.3 612.8 1.00
head pedersen 609.5 ± 5.8 605.5 625.4 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.061 ± 0.002 1.059 1.064 1.00
head poseidon_integration_benchmark 1.066 ± 0.001 1.064 1.067 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.924 ± 0.006 1.913 1.932 1.00
head secp_integration_benchmark 1.956 ± 0.006 1.948 1.966 1.02 ± 0.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 771.3 ± 1.1 769.6 773.2 1.00
head set_integration_benchmark 772.9 ± 1.1 771.5 775.1 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.552 ± 0.034 4.523 4.618 1.00
head uint256_integration_benchmark 4.622 ± 0.030 4.586 4.680 1.02 ± 0.01
codecov[bot] commented 7 months ago

Codecov Report

Attention: 60 lines in your changes are missing coverage. Please review.

Comparison is base (64a1e97) 97.16% compared to head (111bdd0) 97.13%.

Files Patch % Lines
cairo1-run/src/cairo_run.rs 88.24% 59 Missing :warning:
cairo1-run/src/main.rs 92.30% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1601 +/- ## ========================================== - Coverage 97.16% 97.13% -0.03% ========================================== Files 91 92 +1 Lines 37326 37347 +21 ========================================== + Hits 36266 36276 +10 - Misses 1060 1071 +11 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.