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
485 stars 132 forks source link

refactor: Add boolean method `Cairo1RunConfig::copy_to_output` + Update Doc #1778

Closed fmoletta closed 1 month ago

fmoletta commented 1 month ago

Replaces instances of cairo_run_config.proof_mode || cairo_run_config.append_return_values with cairo_run_config.copy_to_output() Updates Documentation to reflect previous changes

github-actions[bot] commented 1 month ago
**Hyper Thereading Benchmark results**

hyperfine -r 2 -n "hyper_threading_main threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_main' -n "hyper_threading_pr threads: 1" 'RAYON_NUM_THREADS=1 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 1
  Time (mean ± σ):     27.718 s ±  0.002 s    [User: 26.923 s, System: 0.794 s]
  Range (min … max):   27.716 s … 27.719 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     27.796 s ±  0.113 s    [User: 27.028 s, System: 0.766 s]
  Range (min … max):   27.716 s … 27.876 s    2 runs

Summary
  'hyper_threading_main threads: 1' ran
    1.00 ± 0.00 times faster than 'hyper_threading_pr threads: 1'

hyperfine -r 2 -n "hyper_threading_main threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_main' -n "hyper_threading_pr threads: 2" 'RAYON_NUM_THREADS=2 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 2
  Time (mean ± σ):     15.095 s ±  0.031 s    [User: 27.806 s, System: 0.770 s]
  Range (min … max):   15.073 s … 15.117 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     15.069 s ±  0.003 s    [User: 27.682 s, System: 0.806 s]
  Range (min … max):   15.067 s … 15.072 s    2 runs

Summary
  'hyper_threading_pr threads: 2' ran
    1.00 ± 0.00 times faster than 'hyper_threading_main threads: 2'

hyperfine -r 2 -n "hyper_threading_main threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_main' -n "hyper_threading_pr threads: 4" 'RAYON_NUM_THREADS=4 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 4
  Time (mean ± σ):     11.097 s ±  0.180 s    [User: 38.620 s, System: 1.018 s]
  Range (min … max):   10.970 s … 11.224 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     11.030 s ±  0.119 s    [User: 38.672 s, System: 0.982 s]
  Range (min … max):   10.946 s … 11.114 s    2 runs

Summary
  'hyper_threading_pr threads: 4' ran
    1.01 ± 0.02 times faster than 'hyper_threading_main threads: 4'

hyperfine -r 2 -n "hyper_threading_main threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_main' -n "hyper_threading_pr threads: 6" 'RAYON_NUM_THREADS=6 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 6
  Time (mean ± σ):     10.864 s ±  0.167 s    [User: 38.806 s, System: 1.022 s]
  Range (min … max):   10.746 s … 10.982 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.580 s ±  0.077 s    [User: 38.741 s, System: 1.030 s]
  Range (min … max):   10.526 s … 10.634 s    2 runs

Summary
  'hyper_threading_pr threads: 6' ran
    1.03 ± 0.02 times faster than 'hyper_threading_main threads: 6'

hyperfine -r 2 -n "hyper_threading_main threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_main' -n "hyper_threading_pr threads: 8" 'RAYON_NUM_THREADS=8 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 8
  Time (mean ± σ):     10.486 s ±  0.079 s    [User: 39.218 s, System: 1.030 s]
  Range (min … max):   10.430 s … 10.542 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.582 s ±  0.126 s    [User: 39.076 s, System: 0.991 s]
  Range (min … max):   10.493 s … 10.671 s    2 runs

Summary
  'hyper_threading_main threads: 8' ran
    1.01 ± 0.01 times faster than 'hyper_threading_pr threads: 8'

hyperfine -r 2 -n "hyper_threading_main threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_main' -n "hyper_threading_pr threads: 16" 'RAYON_NUM_THREADS=16 ./hyper_threading_pr'
Benchmark 1: hyper_threading_main threads: 16
  Time (mean ± σ):     10.547 s ±  0.046 s    [User: 39.499 s, System: 1.149 s]
  Range (min … max):   10.515 s … 10.580 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.566 s ±  0.320 s    [User: 39.520 s, System: 1.092 s]
  Range (min … max):   10.340 s … 10.792 s    2 runs

Summary
  'hyper_threading_main threads: 16' ran
    1.00 ± 0.03 times faster than 'hyper_threading_pr threads: 16'
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.78%. Comparing base (05352b1) to head (d9c0c21).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1778 +/- ## ======================================= Coverage 94.78% 94.78% ======================================= Files 101 101 Lines 39005 39014 +9 ======================================= + Hits 36969 36978 +9 Misses 2036 2036 ```

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

github-actions[bot] commented 1 month ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.073 ± 0.022 2.053 2.106 1.00
head big_factorial 2.096 ± 0.030 2.057 2.133 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.054 ± 0.037 2.012 2.120 1.01 ± 0.02
head big_fibonacci 2.039 ± 0.017 1.996 2.061 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.861 ± 0.150 7.624 8.007 1.00
head blake2s_integration_benchmark 7.971 ± 0.421 7.656 9.131 1.01 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.190 ± 0.046 2.148 2.291 1.01 ± 0.03
head compare_arrays_200000 2.176 ± 0.044 2.132 2.287 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.419 ± 0.024 1.399 1.471 1.00
head dict_integration_benchmark 1.422 ± 0.012 1.407 1.452 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.321 ± 0.022 1.295 1.359 1.00 ± 0.02
head field_arithmetic_get_square_benchmark 1.316 ± 0.024 1.295 1.370 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.884 ± 0.107 7.681 7.969 1.00
head integration_builtins 7.968 ± 0.475 7.600 8.978 1.01 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.119 ± 0.301 7.832 8.829 1.01 ± 0.04
head keccak_integration_benchmark 8.077 ± 0.149 7.838 8.214 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.164 ± 0.086 2.112 2.399 1.02 ± 0.05
head linear_search 2.125 ± 0.044 2.090 2.244 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.712 ± 0.037 1.688 1.814 1.01 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.702 ± 0.014 1.680 1.733 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.627 ± 0.009 1.613 1.639 1.01 ± 0.01
head math_integration_benchmark 1.606 ± 0.006 1.597 1.618 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.227 ± 0.024 1.211 1.277 1.00
head memory_integration_benchmark 1.248 ± 0.064 1.213 1.427 1.02 ± 0.06
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.821 ± 0.014 1.810 1.853 1.00
head operations_with_data_structures_benchmarks 1.829 ± 0.037 1.806 1.932 1.00 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 524.4 ± 5.2 520.0 538.2 1.00 ± 0.01
head pedersen 522.0 ± 3.5 518.2 528.6 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 955.9 ± 4.3 950.1 961.9 1.00
head poseidon_integration_benchmark 960.1 ± 5.9 949.5 967.8 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.888 ± 0.026 1.864 1.950 1.00 ± 0.02
head secp_integration_benchmark 1.882 ± 0.017 1.860 1.918 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 644.5 ± 3.8 639.5 649.2 1.00
head set_integration_benchmark 646.7 ± 10.3 640.1 674.9 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.285 ± 0.064 4.220 4.369 1.00
head uint256_integration_benchmark 4.316 ± 0.119 4.202 4.624 1.01 ± 0.03