Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cairo1-run crate #1601

Merged
merged 8 commits into from
Feb 7, 2024
Merged

Refactor cairo1-run crate #1601

merged 8 commits into from
Feb 7, 2024

Conversation

fmoletta
Copy link
Member

@fmoletta fmoletta commented Feb 6, 2024

This PR consists of two refactors:

  • Creating a cairo_run function that executes a sierra program and returns the runner, vm and return values (Similar to cairo_vm's cairo_run function) and using it in the run function. The run function now only contains code related to compiling the sierra program, serializing the program output & fetching and writing outputs into files.

  • Refactoring the new cairo_run function's code into different functions for each step of the process instead of the current monolithic block of code

Copy link

github-actions bot commented Feb 6, 2024

Benchmark Results for unmodified programs 🚀

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

Copy link

codecov bot commented Feb 6, 2024

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 ⚠️
cairo1-run/src/main.rs 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fmoletta fmoletta marked this pull request as ready for review February 6, 2024 16:54
igaray
igaray previously approved these changes Feb 6, 2024
@fmoletta fmoletta added this pull request to the merge queue Feb 7, 2024
Merged via the queue into main with commit 7abbb39 Feb 7, 2024
49 of 50 checks passed
@fmoletta fmoletta deleted the refactor-cairo1-run branch February 7, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants