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

feat: add Program method for iterating identifiers #1079

Merged
merged 5 commits into from
Apr 27, 2023

Conversation

MegaRedHand
Copy link
Contributor

Description

This PR adds Program::iter_identifiers, to let crate consumers access all of a program's identifiers without accessing it's attributes.

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.

@github-actions
Copy link

github-actions bot commented Apr 26, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 2.523 ± 0.075 2.449 2.704 1.02 ± 0.03
head blake2s_integration_benchmark 2.478 ± 0.033 2.443 2.556 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 3.078 ± 0.053 3.016 3.175 1.00
head compare_arrays_200000 3.079 ± 0.053 3.012 3.169 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.414 ± 0.028 2.375 2.462 1.01 ± 0.02
head dict_integration_benchmark 2.392 ± 0.026 2.355 2.430 1.00
Command Mean [s] Min [s] Max [s] Relative
base factorial_multirun 3.796 ± 0.042 3.739 3.891 1.00 ± 0.01
head factorial_multirun 3.796 ± 0.036 3.747 3.857 1.00
Command Mean [s] Min [s] Max [s] Relative
base fibonacci_1000_multirun 3.009 ± 0.029 2.974 3.067 1.00
head fibonacci_1000_multirun 3.015 ± 0.033 2.970 3.073 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base field_arithmetic_get_square_benchmark 131.3 ± 1.9 129.4 135.6 1.00
head field_arithmetic_get_square_benchmark 132.4 ± 1.6 130.7 135.5 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 2.973 ± 0.025 2.930 3.002 1.00 ± 0.01
head integration_builtins 2.959 ± 0.032 2.911 3.004 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 2.677 ± 0.034 2.619 2.719 1.01 ± 0.02
head keccak_integration_benchmark 2.655 ± 0.026 2.635 2.725 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 3.160 ± 0.024 3.119 3.192 1.00 ± 0.01
head linear_search 3.159 ± 0.026 3.128 3.198 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 2.676 ± 0.014 2.654 2.696 1.00
head math_cmp_and_pow_integration_benchmark 2.725 ± 0.070 2.647 2.857 1.02 ± 0.03
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.480 ± 0.031 2.452 2.540 1.00 ± 0.01
head math_integration_benchmark 2.470 ± 0.017 2.446 2.500 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.136 ± 0.017 2.115 2.175 1.00 ± 0.01
head memory_integration_benchmark 2.129 ± 0.024 2.105 2.182 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.207 ± 0.018 2.183 2.243 1.00
head operations_with_data_structures_benchmarks 2.209 ± 0.015 2.184 2.223 1.00 ± 0.01
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 778.5 ± 3.9 774.3 784.1 1.00
head pedersen 784.1 ± 7.3 773.1 800.0 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.516 ± 0.012 1.505 1.545 1.01 ± 0.01
head poseidon_integration_benchmark 1.508 ± 0.009 1.495 1.520 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.349 ± 0.024 2.325 2.408 1.01 ± 0.01
head secp_integration_benchmark 2.336 ± 0.010 2.321 2.348 1.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.694 ± 0.017 1.678 1.732 1.00
head set_integration_benchmark 1.697 ± 0.013 1.684 1.722 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 3.924 ± 0.027 3.882 3.966 1.01 ± 0.01
head uint256_integration_benchmark 3.901 ± 0.017 3.866 3.920 1.00

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Merging #1079 (b34c7b2) into main (45a43aa) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1079   +/-   ##
=======================================
  Coverage   98.09%   98.09%           
=======================================
  Files          84       84           
  Lines       33867    33935   +68     
=======================================
+ Hits        33222    33290   +68     
  Misses        645      645           
Impacted Files Coverage Δ
src/types/program.rs 99.42% <100.00%> (+0.06%) ⬆️

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

CHANGELOG.md Outdated
@@ -115,6 +115,8 @@ Add missing hint on vrf.json lib [#1053](https://github.com/lambdaclass/cairo-rs
segments.write_arg(ids.blake2s_ptr_end, padding)
%}

* Add `Program::iter_identifiers(&self) -> Iterator<Item = (&String, &Identifier)>` to get an iterator over the program's identifiers [#1079](https://github.com/lambdaclass/cairo-rs/pull/1079)
Copy link
Member

Choose a reason for hiding this comment

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

Make this Program::iter_identifiers(&self) -> Iterator<Item = (&str, &Identifier)>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@fmoletta fmoletta left a comment

Choose a reason for hiding this comment

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

LGTM

@fmoletta fmoletta added this pull request to the merge queue Apr 27, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 27, 2023
@MegaRedHand MegaRedHand added this pull request to the merge queue Apr 27, 2023
Merged via the queue into main with commit 1dc3fe4 Apr 27, 2023
30 checks passed
@MegaRedHand MegaRedHand deleted the add-program-iter_identifiers branch April 27, 2023 13:56
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jun 23, 2023
* Add `Program::iter_identifiers`

* Add unit test

* Update changelog

* Change &String -> &str
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.

None yet

3 participants