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
508 stars 142 forks source link

Implement `Display` for `MemorySegmentManager` #1606

Closed fmoletta closed 6 months ago

fmoletta commented 7 months ago

Adds a Display implementation to the MemorySegmentManager in order to improve the debugging(or other usage) experience from outside the crate in a similar fashion to the Display impl for Memory. Displays the memory (using the Display impl for Memory) and the used size & size for each segment.

Also removes extra characters from Memory Display

codecov[bot] commented 7 months ago

Codecov Report

Attention: 17 lines in your changes are missing coverage. Please review.

Comparison is base (beede16) 97.71% compared to head (82cd26d) 97.66%.

Files Patch % Lines
vm/src/vm/vm_memory/memory_segments.rs 0.00% 17 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1606 +/- ## ========================================== - Coverage 97.71% 97.66% -0.05% ========================================== Files 91 91 Lines 37301 37318 +17 ========================================== Hits 36448 36448 - Misses 853 870 +17 ```

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

github-actions[bot] commented 7 months ago

Benchmark Results for unmodified programs :rocket:

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 2.304 ± 0.017 2.271 2.332 1.05 ± 0.02
head big_factorial 2.184 ± 0.032 2.143 2.237 1.00
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 2.290 ± 0.043 2.256 2.387 1.06 ± 0.02
head big_fibonacci 2.166 ± 0.018 2.144 2.192 1.00
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 8.599 ± 0.077 8.499 8.699 1.07 ± 0.01
head blake2s_integration_benchmark 8.067 ± 0.077 7.970 8.167 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 2.341 ± 0.016 2.325 2.384 1.03 ± 0.02
head compare_arrays_200000 2.266 ± 0.030 2.219 2.328 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 1.468 ± 0.008 1.452 1.479 1.03 ± 0.02
head dict_integration_benchmark 1.422 ± 0.022 1.405 1.481 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.407 ± 0.026 1.389 1.479 1.05 ± 0.02
head field_arithmetic_get_square_benchmark 1.345 ± 0.012 1.334 1.376 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.505 ± 0.076 8.429 8.642 1.06 ± 0.01
head integration_builtins 8.036 ± 0.036 7.983 8.107 1.00
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 8.769 ± 0.140 8.676 9.146 1.06 ± 0.02
head keccak_integration_benchmark 8.283 ± 0.087 8.195 8.413 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 2.349 ± 0.027 2.327 2.420 1.03 ± 0.02
head linear_search 2.276 ± 0.025 2.230 2.316 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 1.838 ± 0.029 1.812 1.916 1.02 ± 0.02
head math_cmp_and_pow_integration_benchmark 1.797 ± 0.013 1.778 1.819 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 1.627 ± 0.022 1.606 1.686 1.03 ± 0.02
head math_integration_benchmark 1.578 ± 0.018 1.552 1.603 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 1.277 ± 0.006 1.264 1.284 1.01 ± 0.02
head memory_integration_benchmark 1.261 ± 0.027 1.239 1.322 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 1.904 ± 0.010 1.894 1.927 1.02 ± 0.01
head operations_with_data_structures_benchmarks 1.871 ± 0.013 1.862 1.904 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 593.2 ± 3.9 590.0 603.8 1.01 ± 0.01
head pedersen 584.8 ± 1.6 582.0 587.0 1.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.005 ± 0.031 0.990 1.093 1.02 ± 0.03
head poseidon_integration_benchmark 0.989 ± 0.014 0.972 1.017 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 1.936 ± 0.006 1.930 1.948 1.02 ± 0.01
head secp_integration_benchmark 1.899 ± 0.021 1.875 1.950 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base set_integration_benchmark 730.3 ± 2.1 726.5 734.4 1.01 ± 0.01
head set_integration_benchmark 723.7 ± 8.2 717.2 746.2 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 4.715 ± 0.121 4.638 5.042 1.06 ± 0.03
head uint256_integration_benchmark 4.461 ± 0.050 4.418 4.591 1.00