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

Add lib.rs to cairo1-run #1714

Merged
merged 11 commits into from
Apr 24, 2024
Merged

Add lib.rs to cairo1-run #1714

merged 11 commits into from
Apr 24, 2024

Conversation

fmoletta
Copy link
Member

Closes #1713

Copy link

codecov bot commented Apr 15, 2024

Codecov Report

Attention: Patch coverage is 11.11111% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 94.77%. Comparing base (1a46c9f) to head (e3c45e6).

Files Patch % Lines
cairo1-run/src/cairo_run.rs 0.00% 7 Missing ⚠️
cairo1-run/src/error.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1714      +/-   ##
==========================================
- Coverage   94.78%   94.77%   -0.02%     
==========================================
  Files         100      101       +1     
  Lines       38322    38327       +5     
==========================================
- Hits        36325    36324       -1     
- Misses       1997     2003       +6     

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

Copy link

github-actions bot commented Apr 15, 2024

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 1.926 ± 0.031 1.886 2.007 1.01 ± 0.02
head big_factorial 1.910 ± 0.019 1.883 1.931 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 1.870 ± 0.019 1.842 1.895 1.00 ± 0.02
head big_fibonacci 1.865 ± 0.040 1.821 1.937 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 6.473 ± 0.067 6.353 6.555 1.00 ± 0.01
head blake2s_integration_benchmark 6.444 ± 0.063 6.355 6.534 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 1.928 ± 0.020 1.911 1.961 1.00
head compare_arrays_200000 1.942 ± 0.022 1.913 1.968 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.322 ± 0.024 1.300 1.385 1.01 ± 0.02
head dict_integration_benchmark 1.312 ± 0.013 1.294 1.328 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.176 ± 0.020 1.154 1.209 1.00 ± 0.04
head field_arithmetic_get_square_benchmark 1.174 ± 0.044 1.146 1.294 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 6.660 ± 0.317 6.432 7.532 1.02 ± 0.05
head integration_builtins 6.546 ± 0.120 6.405 6.837 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 6.680 ± 0.080 6.587 6.787 1.00 ± 0.02
head keccak_integration_benchmark 6.654 ± 0.089 6.561 6.773 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 1.944 ± 0.023 1.909 1.987 1.00
head linear_search 1.947 ± 0.017 1.917 1.967 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.686 ± 0.035 1.660 1.756 1.01 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.672 ± 0.019 1.649 1.705 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.474 ± 0.021 1.453 1.525 1.00 ± 0.02
head math_integration_benchmark 1.472 ± 0.016 1.453 1.504 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.140 ± 0.009 1.122 1.150 1.00 ± 0.03
head memory_integration_benchmark 1.135 ± 0.028 1.111 1.207 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.769 ± 0.011 1.747 1.785 1.01 ± 0.01
head operations_with_data_structures_benchmarks 1.757 ± 0.013 1.739 1.774 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 499.5 ± 2.7 494.8 502.9 1.00
head pedersen 500.6 ± 6.3 495.0 517.0 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base poseidon_integration_benchmark 949.6 ± 10.3 938.9 974.8 1.00
head poseidon_integration_benchmark 950.5 ± 9.6 938.3 968.1 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.739 ± 0.016 1.717 1.772 1.00
head secp_integration_benchmark 1.747 ± 0.015 1.729 1.774 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 685.2 ± 5.4 679.6 697.8 1.01 ± 0.01
head set_integration_benchmark 680.6 ± 2.6 677.3 684.2 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 3.768 ± 0.042 3.721 3.829 1.00
head uint256_integration_benchmark 3.785 ± 0.113 3.700 4.082 1.00 ± 0.03

@fmoletta fmoletta marked this pull request as ready for review April 15, 2024 19:39
Copy link
Member

@juanbono juanbono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to add some docs to the structs and functions exported by this new crate.

Copy link
Member

@juanbono juanbono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

cairo1-run/src/cairo_run.rs Show resolved Hide resolved
cairo1-run/src/cairo_run.rs Show resolved Hide resolved
cairo1-run/src/cairo_run.rs Show resolved Hide resolved
Copy link

github-actions bot commented Apr 17, 2024

**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 ± σ):     23.757 s ±  0.004 s    [User: 22.938 s, System: 0.818 s]
  Range (min … max):   23.754 s … 23.759 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 1
  Time (mean ± σ):     23.760 s ±  0.011 s    [User: 23.033 s, System: 0.724 s]
  Range (min … max):   23.753 s … 23.768 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 ± σ):     12.332 s ±  0.010 s    [User: 23.597 s, System: 0.628 s]
  Range (min … max):   12.325 s … 12.339 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 2
  Time (mean ± σ):     12.387 s ±  0.016 s    [User: 23.779 s, System: 0.668 s]
  Range (min … max):   12.375 s … 12.398 s    2 runs
 
Summary
  'hyper_threading_main threads: 2' ran
    1.00 ± 0.00 times faster than 'hyper_threading_pr 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 ± σ):      9.942 s ±  0.093 s    [User: 34.864 s, System: 0.940 s]
  Range (min … max):    9.876 s … 10.008 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 4
  Time (mean ± σ):      9.497 s ±  0.012 s    [User: 35.181 s, System: 0.957 s]
  Range (min … max):    9.488 s …  9.505 s    2 runs
 
Summary
  'hyper_threading_pr threads: 4' ran
    1.05 ± 0.01 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 ± σ):      9.733 s ±  0.064 s    [User: 35.029 s, System: 1.039 s]
  Range (min … max):    9.688 s …  9.778 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 6
  Time (mean ± σ):      9.607 s ±  0.020 s    [User: 35.211 s, System: 0.945 s]
  Range (min … max):    9.593 s …  9.622 s    2 runs
 
Summary
  'hyper_threading_pr threads: 6' ran
    1.01 ± 0.01 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 ± σ):      9.527 s ±  0.059 s    [User: 35.183 s, System: 1.044 s]
  Range (min … max):    9.486 s …  9.569 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 8
  Time (mean ± σ):      9.586 s ±  0.186 s    [User: 35.405 s, System: 0.940 s]
  Range (min … max):    9.455 s …  9.717 s    2 runs
 
Summary
  'hyper_threading_main threads: 8' ran
    1.01 ± 0.02 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 ± σ):      9.762 s ±  0.036 s    [User: 35.355 s, System: 1.038 s]
  Range (min … max):    9.737 s …  9.788 s    2 runs
 
Benchmark 2: hyper_threading_pr threads: 16
  Time (mean ± σ):      9.701 s ±  0.053 s    [User: 35.439 s, System: 1.020 s]
  Range (min … max):    9.664 s …  9.739 s    2 runs
 
Summary
  'hyper_threading_pr threads: 16' ran
    1.01 ± 0.01 times faster than 'hyper_threading_main threads: 16'


@pefontana pefontana added this pull request to the merge queue Apr 24, 2024
Merged via the queue into main with commit 87dcd17 Apr 24, 2024
70 of 71 checks passed
@pefontana pefontana deleted the add-lib-rs-to-cairo1-run branch April 24, 2024 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Enable Access to cairo1-run Functionality and Types in External Rust Projects
3 participants