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: expose data_len accessor in Program #1022

Merged
merged 2 commits into from
Apr 20, 2023
Merged

Conversation

Oppen
Copy link
Contributor

@Oppen Oppen commented Apr 20, 2023

While the length of the program data can be obtained from .data_iter().count(), it's obviously much faster to get it in O(1), so let's add a method for it.

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.

@Oppen Oppen marked this pull request as ready for review April 20, 2023 14:19
@Oppen Oppen force-pushed the feat/program_data_len_accessor branch from 9bdf6bd to c2a794c Compare April 20, 2023 14:20
@Oppen Oppen enabled auto-merge April 20, 2023 14:24
@github-actions
Copy link

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 2.645 ± 0.031 2.616 2.719 1.00
head blake2s_integration_benchmark 2.662 ± 0.039 2.632 2.748 1.01 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 3.339 ± 0.060 3.284 3.481 1.01 ± 0.02
head compare_arrays_200000 3.322 ± 0.019 3.300 3.365 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.580 ± 0.119 2.523 2.916 1.02 ± 0.05
head dict_integration_benchmark 2.537 ± 0.008 2.524 2.553 1.00
Command Mean [s] Min [s] Max [s] Relative
base factorial_multirun 3.936 ± 0.025 3.903 3.991 1.00
head factorial_multirun 3.951 ± 0.016 3.930 3.984 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base fibonacci_1000_multirun 3.242 ± 0.186 3.164 3.768 1.01 ± 0.06
head fibonacci_1000_multirun 3.199 ± 0.014 3.178 3.225 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 3.222 ± 0.017 3.201 3.246 1.00
head integration_builtins 3.255 ± 0.027 3.227 3.316 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 2.825 ± 0.016 2.803 2.844 1.00
head keccak_integration_benchmark 2.840 ± 0.010 2.817 2.851 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base linear_search 3.468 ± 0.210 3.374 4.061 1.02 ± 0.06
head linear_search 3.404 ± 0.034 3.366 3.487 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 2.876 ± 0.029 2.843 2.942 1.00
head math_cmp_and_pow_integration_benchmark 2.884 ± 0.042 2.860 2.998 1.00 ± 0.02
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.616 ± 0.016 2.598 2.640 1.00
head math_integration_benchmark 2.639 ± 0.011 2.622 2.663 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.280 ± 0.015 2.264 2.317 1.00
head memory_integration_benchmark 2.291 ± 0.009 2.282 2.314 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.353 ± 0.013 2.340 2.381 1.00
head operations_with_data_structures_benchmarks 2.355 ± 0.016 2.336 2.388 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base pedersen 3.236 ± 0.032 3.218 3.326 1.00 ± 0.01
head pedersen 3.234 ± 0.012 3.223 3.266 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.561 ± 0.006 1.554 1.576 1.00
head poseidon_integration_benchmark 1.561 ± 0.007 1.552 1.575 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.473 ± 0.015 2.451 2.494 1.00
head secp_integration_benchmark 2.474 ± 0.019 2.463 2.521 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.716 ± 0.006 1.709 1.731 1.00
head set_integration_benchmark 1.724 ± 0.012 1.711 1.749 1.00 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.089 ± 0.018 4.069 4.127 1.00
head uint256_integration_benchmark 4.105 ± 0.014 4.080 4.123 1.00 ± 0.01

@codecov
Copy link

codecov bot commented Apr 20, 2023

Codecov Report

Merging #1022 (3f4d89e) into main (86aac52) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1022   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files          77       77           
  Lines       31911    31944   +33     
=======================================
+ Hits        31289    31322   +33     
  Misses        622      622           
Impacted Files Coverage Δ
src/types/program.rs 99.29% <100.00%> (+0.04%) ⬆️

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

@Oppen Oppen added this pull request to the merge queue Apr 20, 2023
Merged via the queue into main with commit 03d57d3 Apr 20, 2023
@Oppen Oppen deleted the feat/program_data_len_accessor branch April 20, 2023 15:13
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jun 23, 2023
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.

3 participants