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

CairoPieValidation to #[error(transparent)] #1761

Closed pefontana closed 1 month ago

pefontana commented 1 month ago

Chage CairoPieValidation to #[error(transparent)]

Change CairoPieValidation to #[error(transparent)], to revert performance regretions in #1720

Description

Description of the pull request changes and motivation.

Checklist

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.386 s ±  0.057 s    [User: 26.558 s, System: 0.826 s]
  Range (min … max):   27.345 s … 27.427 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     27.161 s ±  0.101 s    [User: 26.394 s, System: 0.766 s]
  Range (min … max):   27.090 s … 27.233 s    2 runs

Summary
  'hyper_threading_pr threads: 1' ran
    1.01 ± 0.00 times faster than 'hyper_threading_main 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 ± σ):     14.778 s ±  0.026 s    [User: 27.000 s, System: 0.746 s]
  Range (min … max):   14.760 s … 14.796 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     14.717 s ±  0.009 s    [User: 26.863 s, System: 0.766 s]
  Range (min … max):   14.710 s … 14.723 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 ± σ):     10.661 s ±  0.179 s    [User: 39.216 s, System: 0.973 s]
  Range (min … max):   10.535 s … 10.787 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     10.862 s ±  0.494 s    [User: 39.078 s, System: 0.981 s]
  Range (min … max):   10.513 s … 11.211 s    2 runs

Summary
  'hyper_threading_main threads: 4' ran
    1.02 ± 0.05 times faster than 'hyper_threading_pr 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.739 s ±  0.070 s    [User: 39.669 s, System: 0.946 s]
  Range (min … max):   10.689 s … 10.788 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     10.843 s ±  0.232 s    [User: 38.775 s, System: 1.006 s]
  Range (min … max):   10.678 s … 11.007 s    2 runs

Summary
  'hyper_threading_main threads: 6' ran
    1.01 ± 0.02 times faster than 'hyper_threading_pr 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.724 s ±  0.131 s    [User: 39.403 s, System: 1.004 s]
  Range (min … max):   10.631 s … 10.817 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     10.718 s ±  0.181 s    [User: 39.387 s, System: 1.054 s]
  Range (min … max):   10.590 s … 10.846 s    2 runs

Summary
  'hyper_threading_pr threads: 8' ran
    1.00 ± 0.02 times faster than 'hyper_threading_main 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.531 s ±  0.087 s    [User: 40.012 s, System: 1.083 s]
  Range (min … max):   10.469 s … 10.593 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     10.732 s ±  0.193 s    [User: 39.767 s, System: 0.954 s]
  Range (min … max):   10.596 s … 10.868 s    2 runs

Summary
  'hyper_threading_main threads: 16' ran
    1.02 ± 0.02 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.79%. Comparing base (9ef2ab8) to head (e27c699).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1761 +/- ## ======================================= Coverage 94.79% 94.79% ======================================= Files 101 101 Lines 38723 38723 ======================================= Hits 36709 36709 Misses 2014 2014 ```

: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.077 ± 0.034 2.050 2.142 1.03 ± 0.02
head big_factorial 2.009 ± 0.009 2.002 2.033 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.011 ± 0.042 1.986 2.130 1.03 ± 0.02
head big_fibonacci 1.956 ± 0.013 1.940 1.977 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 7.672 ± 0.113 7.518 7.932 1.03 ± 0.02
head blake2s_integration_benchmark 7.468 ± 0.062 7.360 7.564 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.144 ± 0.076 2.109 2.357 1.02 ± 0.04
head compare_arrays_200000 2.094 ± 0.023 2.062 2.138 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.415 ± 0.008 1.407 1.436 1.02 ± 0.01
head dict_integration_benchmark 1.387 ± 0.012 1.372 1.415 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.285 ± 0.011 1.267 1.297 1.01 ± 0.01
head field_arithmetic_get_square_benchmark 1.269 ± 0.008 1.257 1.284 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 7.612 ± 0.119 7.423 7.721 1.02 ± 0.02
head integration_builtins 7.431 ± 0.044 7.385 7.495 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 7.837 ± 0.118 7.639 7.980 1.00 ± 0.04
head keccak_integration_benchmark 7.807 ± 0.281 7.599 8.590 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.083 ± 0.018 2.066 2.131 1.00
head linear_search 2.086 ± 0.084 2.039 2.317 1.00 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.697 ± 0.019 1.682 1.748 1.01 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.682 ± 0.031 1.661 1.747 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.606 ± 0.005 1.596 1.613 1.02 ± 0.01
head math_integration_benchmark 1.577 ± 0.008 1.567 1.592 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.198 ± 0.004 1.193 1.205 1.02 ± 0.01
head memory_integration_benchmark 1.176 ± 0.006 1.170 1.188 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.820 ± 0.014 1.810 1.857 1.01 ± 0.01
head operations_with_data_structures_benchmarks 1.795 ± 0.018 1.783 1.843 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 516.1 ± 2.8 512.6 522.4 1.00 ± 0.03
head pedersen 514.7 ± 14.2 508.9 555.1 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 954.3 ± 4.5 945.0 959.7 1.00 ± 0.01
head poseidon_integration_benchmark 952.9 ± 7.7 944.5 972.2 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.839 ± 0.024 1.823 1.903 1.00
head secp_integration_benchmark 1.857 ± 0.014 1.843 1.889 1.01 ± 0.02
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 665.1 ± 5.3 661.6 676.2 1.01 ± 0.01
head set_integration_benchmark 660.5 ± 4.5 656.6 672.6 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.202 ± 0.056 4.118 4.292 1.00
head uint256_integration_benchmark 4.228 ± 0.317 4.094 5.127 1.01 ± 0.08