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

perf: represent pc:hint mapping as a vector indexed by ranges #931

Merged
merged 4 commits into from
Jul 14, 2023

Conversation

Oppen
Copy link
Member

@Oppen Oppen commented Mar 30, 2023

Replaces the use of HashMap<usize, _> to store hint data with Vec<_> and
ranges in the form Vec<Option<(usize, NonZeroUsize)>>, where the index
corresponds to the given PC, the first field is the first index in the hints
Vec and the second one is the length of such range.
This avoids the cost of hashing and reduces memory fragmentation by collapsing
all of the individual Vecs of each PC into a single bigger Vec. The cost of
this is two extra machine words per PC for storing the ranges, as well as some
increase in code complexity.

Benchmark results

In files suffixed by -proof additional arguments --memory_file /dev/null --trace_file /dev/null --proof_mode are passed. -quick runs don't generate traces nor dump memory.

blake2s_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 6.175 ± 0.055 6.098 6.334 1.20 ± 0.01
base-bigint 5.686 ± 0.043 5.638 5.921 1.10 ± 0.01
ranges-felt 5.564 ± 0.024 5.516 5.612 1.08 ± 0.01
ranges-bigint 5.150 ± 0.029 5.127 5.278 1.00

blake2s_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 820.3 ± 6.8 810.9 846.5 1.08 ± 0.01
base-bigint 1004.3 ± 5.9 994.6 1023.1 1.32 ± 0.02
ranges-felt 761.2 ± 8.4 736.9 778.2 1.00
ranges-bigint 983.7 ± 14.2 939.9 1012.9 1.29 ± 0.02

compare_arrays_200000-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.750 ± 0.018 1.712 1.796 1.09 ± 0.02
base-bigint 1.972 ± 0.009 1.956 1.992 1.22 ± 0.02
ranges-felt 1.612 ± 0.019 1.581 1.688 1.00
ranges-bigint 1.805 ± 0.014 1.774 1.852 1.12 ± 0.02

compare_arrays_200000-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 888.3 ± 5.7 871.2 905.9 1.09 ± 0.02
base-bigint 1119.7 ± 8.6 1106.2 1139.5 1.38 ± 0.02
ranges-felt 813.7 ± 11.0 782.0 838.6 1.00
ranges-bigint 1059.3 ± 33.7 1039.6 1281.1 1.30 ± 0.05

dict_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.127 ± 0.008 1.115 1.145 1.07 ± 0.01
base-bigint 1.327 ± 0.006 1.318 1.357 1.26 ± 0.01
ranges-felt 1.054 ± 0.004 1.049 1.072 1.00
ranges-bigint 1.252 ± 0.007 1.234 1.273 1.19 ± 0.01

dict_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 741.6 ± 7.1 732.5 768.3 1.08 ± 0.02
base-bigint 922.8 ± 7.6 913.0 938.7 1.35 ± 0.03
ranges-felt 685.3 ± 11.6 667.7 744.6 1.00
ranges-bigint 874.7 ± 5.5 868.7 903.6 1.28 ± 0.02

ec_op-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 4.725 ± 0.080 4.668 5.117 1.01 ± 0.03
base-bigint 8.449 ± 0.118 8.336 8.897 1.81 ± 0.05
ranges-felt 4.674 ± 0.104 4.489 5.229 1.00
ranges-bigint 8.510 ± 0.101 8.343 8.758 1.82 ± 0.05

ec_op-quick.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 4.615 ± 0.047 4.561 4.784 1.01 ± 0.02
base-bigint 8.433 ± 0.100 8.197 8.761 1.84 ± 0.04
ranges-felt 4.578 ± 0.069 4.475 4.872 1.00
ranges-bigint 8.380 ± 0.087 8.297 8.682 1.83 ± 0.03

factorial_multirun-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.548 ± 0.017 1.518 1.601 1.00
base-bigint 1.938 ± 0.028 1.912 2.056 1.25 ± 0.02
ranges-felt 1.561 ± 0.006 1.551 1.576 1.01 ± 0.01
ranges-bigint 1.979 ± 0.014 1.937 2.019 1.28 ± 0.02

factorial_multirun-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 854.1 ± 13.3 822.4 885.6 1.00
base-bigint 1259.2 ± 23.4 1218.8 1337.2 1.47 ± 0.04
ranges-felt 856.1 ± 9.6 845.2 879.5 1.00 ± 0.02
ranges-bigint 1292.8 ± 25.0 1252.7 1374.4 1.51 ± 0.04

fibonacci_1000_multirun-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.592 ± 0.012 1.557 1.609 1.00
base-bigint 1.729 ± 0.010 1.716 1.765 1.09 ± 0.01
ranges-felt 1.597 ± 0.010 1.557 1.612 1.00 ± 0.01
ranges-bigint 1.762 ± 0.013 1.721 1.797 1.11 ± 0.01

fibonacci_1000_multirun-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 809.8 ± 8.3 798.5 843.2 1.00
base-bigint 981.9 ± 10.3 970.1 1017.9 1.21 ± 0.02
ranges-felt 824.7 ± 9.9 810.5 867.6 1.02 ± 0.02
ranges-bigint 1026.5 ± 6.9 1009.4 1043.0 1.27 ± 0.02

field_arithmetic_get_square_benchmark-proof.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 73.7 ± 1.8 72.4 85.8 1.05 ± 0.03
base-bigint 74.8 ± 0.4 74.4 77.1 1.07 ± 0.01
ranges-felt 69.9 ± 0.4 69.3 71.3 1.00
ranges-bigint 70.0 ± 0.3 69.6 70.7 1.00 ± 0.01

field_arithmetic_get_square_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 42.7 ± 0.2 42.3 43.3 1.07 ± 0.01
base-bigint 45.9 ± 0.2 45.4 47.0 1.15 ± 0.02
ranges-felt 40.0 ± 0.5 39.5 41.9 1.00
ranges-bigint 42.9 ± 0.5 42.2 44.5 1.07 ± 0.02

find_element-proof.md

find_element-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 507.4 ± 4.7 498.8 527.2 1.11 ± 0.02
base-bigint 647.7 ± 6.4 638.2 666.7 1.42 ± 0.03
ranges-felt 455.2 ± 7.8 432.8 473.7 1.00
ranges-bigint 623.6 ± 12.7 591.3 690.8 1.37 ± 0.04

integration_builtins-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 5.650 ± 0.104 5.512 6.060 1.13 ± 0.02
base-bigint 4.999 ± 0.050 4.938 5.084 1.00
ranges-felt 5.540 ± 0.049 5.409 5.676 1.11 ± 0.01
ranges-bigint 5.134 ± 0.065 5.080 5.395 1.03 ± 0.02

integration_builtins-quick.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.020 ± 0.004 1.016 1.031 1.00
base-bigint 1.104 ± 0.006 1.091 1.116 1.08 ± 0.01
ranges-felt 1.030 ± 0.006 1.022 1.060 1.01 ± 0.01
ranges-bigint 1.131 ± 0.011 1.118 1.176 1.11 ± 0.01

keccak_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 6.150 ± 0.134 5.937 6.564 1.21 ± 0.03
base-bigint 5.568 ± 0.108 5.392 6.036 1.09 ± 0.02
ranges-felt 5.575 ± 0.041 5.523 5.722 1.09 ± 0.01
ranges-bigint 5.099 ± 0.053 5.059 5.324 1.00

keccak_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 984.8 ± 20.9 956.0 1021.2 1.06 ± 0.03
base-bigint 1085.9 ± 17.0 1052.5 1121.2 1.17 ± 0.03
ranges-felt 929.2 ± 15.0 905.9 959.7 1.00
ranges-bigint 1059.2 ± 16.9 1030.7 1091.3 1.14 ± 0.03

linear_search-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.783 ± 0.015 1.761 1.835 1.08 ± 0.01
base-bigint 1.980 ± 0.011 1.960 2.000 1.20 ± 0.01
ranges-felt 1.651 ± 0.015 1.612 1.714 1.00
ranges-bigint 1.846 ± 0.009 1.826 1.878 1.12 ± 0.01

linear_search-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 931.2 ± 7.6 904.1 965.9 1.10 ± 0.01
base-bigint 1159.0 ± 8.1 1149.2 1196.3 1.37 ± 0.02
ranges-felt 845.5 ± 9.1 823.3 887.2 1.00
ranges-bigint 1077.1 ± 11.9 1066.6 1126.4 1.27 ± 0.02

math_cmp_and_pow_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.148 ± 0.005 1.138 1.159 1.06 ± 0.01
base-bigint 1.331 ± 0.004 1.324 1.342 1.23 ± 0.01
ranges-felt 1.080 ± 0.005 1.071 1.104 1.00
ranges-bigint 1.258 ± 0.015 1.246 1.351 1.17 ± 0.01

math_cmp_and_pow_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 765.1 ± 3.9 757.4 775.6 1.09 ± 0.01
base-bigint 950.7 ± 6.8 942.4 975.6 1.36 ± 0.01
ranges-felt 700.4 ± 5.1 694.0 723.4 1.00
ranges-bigint 889.0 ± 7.9 879.7 931.9 1.27 ± 0.01

math_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.115 ± 0.008 1.103 1.145 1.07 ± 0.01
base-bigint 1.259 ± 0.008 1.245 1.295 1.21 ± 0.01
ranges-felt 1.043 ± 0.005 1.038 1.071 1.00
ranges-bigint 1.178 ± 0.004 1.169 1.185 1.13 ± 0.01

math_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 751.3 ± 7.5 745.1 775.4 1.12 ± 0.01
base-bigint 897.7 ± 6.3 888.7 923.6 1.34 ± 0.01
ranges-felt 671.8 ± 3.3 667.4 680.8 1.00
ranges-bigint 832.3 ± 9.8 817.8 876.7 1.24 ± 0.02

memory_integration_benchmark-proof.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 935.2 ± 12.3 915.0 970.0 1.07 ± 0.02
base-bigint 1072.4 ± 12.8 1048.5 1129.3 1.22 ± 0.02
ranges-felt 875.8 ± 5.9 868.6 898.0 1.00
ranges-bigint 1005.1 ± 10.0 992.9 1056.5 1.15 ± 0.01

memory_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 594.1 ± 11.4 574.5 630.0 1.11 ± 0.03
base-bigint 741.0 ± 11.7 729.7 799.7 1.39 ± 0.03
ranges-felt 533.2 ± 9.3 516.5 571.4 1.00
ranges-bigint 683.3 ± 13.7 672.4 735.6 1.28 ± 0.03

operations_with_data_structures_benchmarks-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.121 ± 0.005 1.112 1.131 1.08 ± 0.01
base-bigint 1.238 ± 0.008 1.229 1.278 1.20 ± 0.01
ranges-felt 1.036 ± 0.003 1.031 1.043 1.00
ranges-bigint 1.135 ± 0.004 1.128 1.146 1.10 ± 0.00

operations_with_data_structures_benchmarks-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 672.2 ± 7.6 662.0 689.4 1.11 ± 0.01
base-bigint 781.3 ± 5.3 772.8 804.1 1.29 ± 0.01
ranges-felt 606.3 ± 4.4 595.0 619.6 1.00
ranges-bigint 733.8 ± 5.5 726.1 753.0 1.21 ± 0.01

pedersen-proof.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 407.3 ± 5.1 399.2 424.7 1.00
base-bigint 427.3 ± 4.0 417.4 435.8 1.05 ± 0.02
ranges-felt 411.7 ± 6.7 399.1 431.1 1.01 ± 0.02
ranges-bigint 429.4 ± 7.4 418.3 455.6 1.05 ± 0.02

pedersen-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 320.4 ± 3.7 306.7 331.7 1.00 ± 0.02
base-bigint 335.5 ± 7.2 325.7 350.1 1.05 ± 0.03
ranges-felt 320.3 ± 5.7 308.9 329.6 1.00
ranges-bigint 339.0 ± 10.0 327.3 374.3 1.06 ± 0.04

poseidon_integration_benchmark-proof.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 800.0 ± 3.0 796.1 815.7 1.03 ± 0.01
base-bigint 846.5 ± 3.4 843.5 867.1 1.09 ± 0.01
ranges-felt 773.3 ± 6.6 758.0 784.0 1.00
ranges-bigint 840.2 ± 5.3 834.6 866.6 1.09 ± 0.01

poseidon_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 715.4 ± 2.5 712.2 722.3 1.03 ± 0.00
base-bigint 771.3 ± 1.1 769.0 773.2 1.11 ± 0.00
ranges-felt 693.9 ± 2.3 689.6 702.5 1.00
ranges-bigint 755.7 ± 1.9 751.5 762.0 1.09 ± 0.00

search_sorted_lower-proof.md

search_sorted_lower-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 313.5 ± 7.6 298.9 335.1 1.12 ± 0.03
base-bigint 375.1 ± 5.4 364.9 386.0 1.34 ± 0.03
ranges-felt 279.8 ± 4.8 269.2 292.2 1.00
ranges-bigint 349.9 ± 2.5 346.0 358.3 1.25 ± 0.02

secp_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.347 ± 0.013 1.322 1.398 1.05 ± 0.01
base-bigint 1.511 ± 0.014 1.501 1.577 1.17 ± 0.01
ranges-felt 1.286 ± 0.011 1.261 1.335 1.00
ranges-bigint 1.431 ± 0.005 1.423 1.449 1.11 ± 0.01

secp_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 846.5 ± 10.1 824.5 870.1 1.03 ± 0.01
base-bigint 1028.2 ± 8.2 1003.1 1044.2 1.25 ± 0.01
ranges-felt 821.2 ± 5.2 815.5 842.7 1.00
ranges-bigint 1004.2 ± 4.4 997.7 1018.0 1.22 ± 0.01

set_integration_benchmark-proof.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 560.9 ± 7.8 544.1 579.9 1.03 ± 0.02
base-bigint 849.5 ± 85.0 811.8 1424.5 1.56 ± 0.16
ranges-felt 544.3 ± 9.6 528.3 567.8 1.00
ranges-bigint 827.3 ± 20.5 800.5 885.4 1.52 ± 0.05

set_integration_benchmark-quick.md

Command Mean [ms] Min [ms] Max [ms] Relative
base-felt 452.1 ± 7.3 438.6 468.2 1.03 ± 0.02
base-bigint 738.9 ± 17.6 714.0 788.8 1.68 ± 0.04
ranges-felt 440.5 ± 5.1 427.7 450.6 1.00
ranges-bigint 727.5 ± 8.5 704.3 756.4 1.65 ± 0.03

uint256_integration_benchmark-proof.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 3.527 ± 0.041 3.453 3.603 1.11 ± 0.01
base-bigint 3.470 ± 0.041 3.434 3.683 1.09 ± 0.01
ranges-felt 3.266 ± 0.031 3.197 3.375 1.03 ± 0.01
ranges-bigint 3.176 ± 0.017 3.092 3.237 1.00

uint256_integration_benchmark-quick.md

Command Mean [s] Min [s] Max [s] Relative
base-felt 1.150 ± 0.012 1.102 1.179 1.05 ± 0.01
base-bigint 1.361 ± 0.021 1.302 1.391 1.25 ± 0.02
ranges-felt 1.091 ± 0.009 1.080 1.129 1.00
ranges-bigint 1.277 ± 0.008 1.257 1.315 1.17 ± 0.01

@Oppen Oppen force-pushed the hint_ranges branch 3 times, most recently from 067b99c to c671a90 Compare March 31, 2023 05:21
@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Merging #931 (dca4b62) into main (2d5b2cc) will increase coverage by 0.36%.
The diff coverage is 100.00%.

❗ Current head dca4b62 differs from pull request most recent head 7acc59b. Consider uploading reports for the commit 7acc59b to get more accurate results

@@            Coverage Diff             @@
##             main     #931      +/-   ##
==========================================
+ Coverage   97.53%   97.89%   +0.36%     
==========================================
  Files          92       89       -3     
  Lines       37474    35591    -1883     
==========================================
- Hits        36549    34842    -1707     
+ Misses        925      749     -176     
Impacted Files Coverage Δ
vm/src/serde/deserialize_program.rs 97.32% <100.00%> (+0.06%) ⬆️
vm/src/types/program.rs 99.52% <100.00%> (+0.05%) ⬆️
vm/src/utils.rs 99.50% <100.00%> (+<0.01%) ⬆️
vm/src/vm/hooks.rs 100.00% <100.00%> (ø)
vm/src/vm/runners/cairo_runner.rs 97.94% <100.00%> (+0.03%) ⬆️
vm/src/vm/vm_core.rs 97.79% <100.00%> (ø)

... and 8 files with indirect coverage changes

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

@github-actions
Copy link

github-actions bot commented Apr 27, 2023

Benchmark Results for unmodified programs 🚀

Command Mean [s] Min [s] Max [s] Relative
base big_factorial 3.705 ± 0.019 3.678 3.736 1.00
head big_factorial 3.767 ± 0.016 3.739 3.797 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base big_fibonacci 3.203 ± 0.031 3.179 3.287 1.00
head big_fibonacci 3.227 ± 0.011 3.211 3.251 1.01 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base blake2s_integration_benchmark 10.307 ± 0.268 10.116 11.026 1.10 ± 0.03
head blake2s_integration_benchmark 9.350 ± 0.119 9.187 9.548 1.00
Command Mean [s] Min [s] Max [s] Relative
base compare_arrays_200000 3.564 ± 0.017 3.536 3.589 1.09 ± 0.01
head compare_arrays_200000 3.262 ± 0.014 3.235 3.278 1.00
Command Mean [s] Min [s] Max [s] Relative
base dict_integration_benchmark 2.403 ± 0.010 2.390 2.429 1.07 ± 0.01
head dict_integration_benchmark 2.253 ± 0.011 2.237 2.275 1.00
Command Mean [s] Min [s] Max [s] Relative
base field_arithmetic_get_square_benchmark 1.867 ± 0.009 1.857 1.891 1.07 ± 0.01
head field_arithmetic_get_square_benchmark 1.741 ± 0.011 1.725 1.762 1.00
Command Mean [s] Min [s] Max [s] Relative
base integration_builtins 8.990 ± 0.015 8.976 9.031 1.00
head integration_builtins 9.186 ± 0.051 9.139 9.318 1.02 ± 0.01
Command Mean [s] Min [s] Max [s] Relative
base keccak_integration_benchmark 10.343 ± 0.088 10.260 10.528 1.11 ± 0.01
head keccak_integration_benchmark 9.300 ± 0.050 9.254 9.389 1.00
Command Mean [s] Min [s] Max [s] Relative
base linear_search 3.579 ± 0.022 3.560 3.618 1.09 ± 0.01
head linear_search 3.294 ± 0.013 3.281 3.320 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_cmp_and_pow_integration_benchmark 2.529 ± 0.009 2.514 2.546 1.06 ± 0.01
head math_cmp_and_pow_integration_benchmark 2.379 ± 0.015 2.353 2.406 1.00
Command Mean [s] Min [s] Max [s] Relative
base math_integration_benchmark 2.317 ± 0.007 2.307 2.326 1.06 ± 0.00
head math_integration_benchmark 2.179 ± 0.007 2.167 2.192 1.00
Command Mean [s] Min [s] Max [s] Relative
base memory_integration_benchmark 2.041 ± 0.008 2.034 2.056 1.08 ± 0.01
head memory_integration_benchmark 1.893 ± 0.005 1.885 1.900 1.00
Command Mean [s] Min [s] Max [s] Relative
base operations_with_data_structures_benchmarks 2.291 ± 0.010 2.278 2.309 1.07 ± 0.01
head operations_with_data_structures_benchmarks 2.146 ± 0.009 2.132 2.159 1.00
Command Mean [ms] Min [ms] Max [ms] Relative
base pedersen 826.7 ± 1.5 823.7 830.1 1.00
head pedersen 830.5 ± 1.6 828.2 833.2 1.00 ± 0.00
Command Mean [s] Min [s] Max [s] Relative
base poseidon_integration_benchmark 1.561 ± 0.003 1.555 1.566 1.03 ± 0.00
head poseidon_integration_benchmark 1.522 ± 0.004 1.518 1.532 1.00
Command Mean [s] Min [s] Max [s] Relative
base secp_integration_benchmark 2.653 ± 0.012 2.643 2.683 1.05 ± 0.01
head secp_integration_benchmark 2.520 ± 0.009 2.511 2.536 1.00
Command Mean [s] Min [s] Max [s] Relative
base set_integration_benchmark 1.327 ± 0.037 1.312 1.433 1.05 ± 0.03
head set_integration_benchmark 1.268 ± 0.005 1.260 1.279 1.00
Command Mean [s] Min [s] Max [s] Relative
base uint256_integration_benchmark 6.658 ± 0.049 6.617 6.781 1.08 ± 0.01
head uint256_integration_benchmark 6.147 ± 0.071 6.102 6.337 1.00

@Oppen Oppen force-pushed the hint_ranges branch 2 times, most recently from 42bb627 to ddab497 Compare May 11, 2023 21:38
@Oppen Oppen force-pushed the hint_ranges branch 3 times, most recently from 9829f65 to 35491c6 Compare July 3, 2023 12:55
@Oppen Oppen marked this pull request as ready for review July 3, 2023 12:55
vm/src/types/program.rs Outdated Show resolved Hide resolved
vm/src/serde/deserialize_program.rs Outdated Show resolved Hide resolved
vm/src/utils.rs Outdated Show resolved Hide resolved
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.

Nice!

.hints_ranges
.iter()
.enumerate()
.filter_map(|(pc, r)| r.map(|(s, l)| (pc, (s, s + l.get()))))
Copy link
Contributor

Choose a reason for hiding this comment

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

this is a bit confusing, maybe a comment explaining what is happening would be useful.

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, I'll do that, or maybe I'll see if I can make it simpler.

.hints_ranges
.iter()
.enumerate()
.filter_map(|(pc, r)| r.map(|(s, l)| (pc, (s, s + l.get()))))
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

This avoids costly `HashMap` queries
@Oppen Oppen enabled auto-merge July 11, 2023 14:35
@Oppen Oppen changed the title Hint ranges perf: represent pc:hint mapping as a vector indexed by ranges Jul 11, 2023
@Oppen Oppen added this pull request to the merge queue Jul 11, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Jul 11, 2023
@Oppen Oppen enabled auto-merge July 14, 2023 02:49
@Oppen Oppen added this pull request to the merge queue Jul 14, 2023
Merged via the queue into main with commit 2bd7c19 Jul 14, 2023
32 checks passed
@Oppen Oppen deleted the hint_ranges branch July 14, 2023 04:44
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jul 25, 2023
This avoids costly `HashMap` queries
kariy pushed a commit to dojoengine/cairo-rs that referenced this pull request Jul 25, 2023
This avoids costly `HashMap` queries
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

4 participants