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 RunResources.get_n_steps method #1225

Merged
merged 4 commits into from
Jun 12, 2023
Merged

Add RunResources.get_n_steps method #1225

merged 4 commits into from
Jun 12, 2023

Conversation

pefontana
Copy link
Member

Add RunResources.get_n_steps method

Description

Description of the pull request changes and motivation.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Merging #1225 (416af59) into main (73539d3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1225   +/-   ##
=======================================
  Coverage   97.59%   97.59%           
=======================================
  Files          89       89           
  Lines       36163    36166    +3     
=======================================
+ Hits        35293    35296    +3     
  Misses        870      870           
Impacted Files Coverage Δ
src/vm/runners/cairo_runner.rs 97.97% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Jun 12, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 14.161 ± 0.170 14.007 14.458 1.01 ± 0.01
head blake2s_integration_benchmark 14.081 ± 0.034 14.029 14.140 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 5.068 ± 0.128 4.795 5.214 1.05 ± 0.03
head compare_arrays_200000 4.826 ± 0.054 4.772 4.964 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 3.134 ± 0.038 3.077 3.220 1.00 ± 0.01
head dict_integration_benchmark 3.125 ± 0.022 3.102 3.170 1.00
Command Mean [s] Min [s] Max [s] Relative
base factorial_multirun 5.055 ± 0.022 5.023 5.096 1.01 ± 0.01
head factorial_multirun 5.007 ± 0.038 4.966 5.074 1.00
Command Mean [s] Min [s] Max [s] Relative
base fibonacci_1000_multirun 4.233 ± 0.026 4.208 4.286 1.00 ± 0.01
head fibonacci_1000_multirun 4.230 ± 0.017 4.201 4.251 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base field_arithmetic_get_square_benchmark 205.4 ± 2.3 203.2 209.5 1.01 ± 0.02
head field_arithmetic_get_square_benchmark 203.6 ± 3.9 200.9 214.3 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 12.913 ± 0.180 12.773 13.318 1.00 ± 0.02
head integration_builtins 12.872 ± 0.113 12.756 13.049 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 14.567 ± 0.251 14.350 15.226 1.02 ± 0.02
head keccak_integration_benchmark 14.278 ± 0.138 14.153 14.596 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 4.792 ± 0.036 4.768 4.889 1.00
head linear_search 4.802 ± 0.073 4.743 4.974 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 3.338 ± 0.020 3.320 3.384 1.00 ± 0.01
head math_cmp_and_pow_integration_benchmark 3.337 ± 0.015 3.315 3.357 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 3.073 ± 0.008 3.058 3.088 1.00
head math_integration_benchmark 3.083 ± 0.023 3.061 3.129 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.735 ± 0.080 2.691 2.956 1.02 ± 0.03
head memory_integration_benchmark 2.694 ± 0.011 2.683 2.722 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 3.129 ± 0.062 3.079 3.246 1.01 ± 0.02
head operations_with_data_structures_benchmarks 3.098 ± 0.029 3.078 3.177 1.00
Command Mean [s] Min [s] Max [s] Relative
base pedersen 1.048 ± 0.003 1.043 1.052 1.00
head pedersen 1.048 ± 0.004 1.044 1.056 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.881 ± 0.013 1.872 1.908 1.00
head poseidon_integration_benchmark 1.884 ± 0.010 1.871 1.907 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 3.633 ± 0.015 3.614 3.662 1.00 ± 0.01
head secp_integration_benchmark 3.623 ± 0.011 3.602 3.636 1.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.850 ± 0.008 1.841 1.867 1.00
head set_integration_benchmark 1.854 ± 0.009 1.842 1.869 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 8.862 ± 0.044 8.812 8.944 1.00
head uint256_integration_benchmark 8.954 ± 0.170 8.881 9.433 1.01 ± 0.02

@@ -94,6 +94,10 @@ impl RunResources {
pub fn consume_steps(&mut self) {
self.n_steps -= 1;
}

pub fn get_n_steps(&mut self) -> usize {
Copy link
Member

Choose a reason for hiding this comment

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

why do we need a mutable reference here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, good catch!
copy paste staff

@pefontana pefontana linked an issue Jun 12, 2023 that may be closed by this pull request
@MegaRedHand MegaRedHand added this pull request to the merge queue Jun 12, 2023
Merged via the queue into main with commit 290769d Jun 12, 2023
31 checks passed
@MegaRedHand MegaRedHand deleted the get_n_steps_method branch June 12, 2023 19:28
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jun 23, 2023
* Add RunResources.get_n_steps method

* Update CHANGELOG.md

* use no mut reference
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.

Add RunResources.get_ n_steps method
3 participants