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
514 stars 144 forks source link

Remove python code from doc comments in `program_hash` module #1733

Closed fmoletta closed 5 months ago

fmoletta commented 5 months ago

The doc comments on the public functions of the program_hash module contain blocks of the original cairo_lang python code as reference. This is quite unsightly and also makes cargo test fail due to failing doctest. This PR remoplaces these blocks of python code with links to the actual python code in the cairo_lang repository.

github-actions[bot] commented 5 months 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 ± σ):     30.038 s ±  0.101 s    [User: 29.241 s, System: 0.796 s]
  Range (min … max):   29.967 s … 30.110 s    2 runs

Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     29.930 s ±  0.042 s    [User: 29.192 s, System: 0.736 s]
  Range (min … max):   29.900 s … 29.959 s    2 runs

Summary
  'hyper_threading_pr threads: 1' ran
    1.00 ± 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 ± σ):     16.112 s ±  0.021 s    [User: 29.735 s, System: 0.770 s]
  Range (min … max):   16.097 s … 16.127 s    2 runs

Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     16.033 s ±  0.008 s    [User: 29.626 s, System: 0.755 s]
  Range (min … max):   16.027 s … 16.038 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.518 s ±  0.286 s    [User: 40.298 s, System: 0.985 s]
  Range (min … max):   11.316 s … 11.720 s    2 runs

Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):     11.390 s ±  0.251 s    [User: 40.088 s, System: 0.998 s]
  Range (min … max):   11.212 s … 11.567 s    2 runs

Summary
  'hyper_threading_pr threads: 4' ran
    1.01 ± 0.03 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 ± σ):     11.219 s ±  0.048 s    [User: 40.662 s, System: 0.927 s]
  Range (min … max):   11.185 s … 11.253 s    2 runs

Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):     11.207 s ±  0.204 s    [User: 40.425 s, System: 0.984 s]
  Range (min … max):   11.063 s … 11.352 s    2 runs

Summary
  'hyper_threading_pr threads: 6' ran
    1.00 ± 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.941 s ±  0.077 s    [User: 40.801 s, System: 0.968 s]
  Range (min … max):   10.887 s … 10.995 s    2 runs

Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):     11.058 s ±  0.021 s    [User: 41.000 s, System: 0.973 s]
  Range (min … max):   11.043 s … 11.073 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 ± σ):     11.001 s ±  0.009 s    [User: 40.872 s, System: 1.016 s]
  Range (min … max):   10.995 s … 11.007 s    2 runs

Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):     11.271 s ±  0.072 s    [User: 40.935 s, System: 0.972 s]
  Range (min … max):   11.220 s … 11.321 s    2 runs

Summary
  'hyper_threading_main threads: 16' ran
    1.02 ± 0.01 times faster than 'hyper_threading_pr threads: 16'
codecov[bot] commented 5 months ago

Codecov Report

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

Project coverage is 94.78%. Comparing base (bc276ce) to head (c191c73).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1733 +/- ## ======================================= Coverage 94.78% 94.78% ======================================= Files 101 101 Lines 38731 38731 ======================================= Hits 36711 36711 Misses 2020 2020 ```

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

github-actions[bot] commented 5 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.364 ± 0.014 2.346 2.389 1.00
head big_factorial 2.372 ± 0.019 2.353 2.411 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.327 ± 0.034 2.295 2.415 1.00
head big_fibonacci 2.347 ± 0.070 2.286 2.530 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.717 ± 0.364 8.486 9.524 1.00
head blake2s_integration_benchmark 8.778 ± 0.652 8.487 10.612 1.01 ± 0.09
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.403 ± 0.009 2.392 2.418 1.00
head compare_arrays_200000 2.408 ± 0.016 2.388 2.441 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.523 ± 0.009 1.513 1.541 1.00 ± 0.01
head dict_integration_benchmark 1.520 ± 0.016 1.507 1.552 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.414 ± 0.008 1.405 1.429 1.00
head field_arithmetic_get_square_benchmark 1.426 ± 0.033 1.404 1.511 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.578 ± 0.030 8.535 8.622 1.00
head integration_builtins 8.776 ± 0.334 8.548 9.455 1.02 ± 0.04
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.828 ± 0.131 8.718 9.115 1.01 ± 0.02
head keccak_integration_benchmark 8.774 ± 0.027 8.744 8.827 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.440 ± 0.037 2.412 2.534 1.00
head linear_search 2.458 ± 0.069 2.416 2.644 1.01 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.888 ± 0.019 1.864 1.929 1.00 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.883 ± 0.022 1.863 1.934 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.669 ± 0.020 1.655 1.711 1.00 ± 0.02
head math_integration_benchmark 1.662 ± 0.017 1.650 1.708 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.338 ± 0.020 1.328 1.393 1.01 ± 0.02
head memory_integration_benchmark 1.331 ± 0.006 1.323 1.342 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.957 ± 0.013 1.948 1.990 1.00 ± 0.01
head operations_with_data_structures_benchmarks 1.957 ± 0.013 1.946 1.989 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 562.0 ± 8.5 557.7 585.4 1.00 ± 0.02
head pedersen 559.6 ± 2.6 555.5 564.4 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 994.3 ± 5.4 987.1 1003.0 1.01 ± 0.01
head poseidon_integration_benchmark 987.3 ± 4.0 983.3 995.7 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.984 ± 0.021 1.971 2.043 1.00 ± 0.01
head secp_integration_benchmark 1.977 ± 0.015 1.960 2.004 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 759.4 ± 3.5 753.5 766.9 1.00
head set_integration_benchmark 760.3 ± 5.3 756.3 774.7 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.847 ± 0.166 4.720 5.212 1.02 ± 0.04
head uint256_integration_benchmark 4.755 ± 0.047 4.714 4.875 1.00