Skip to content

Instantly share code, notes, and snippets.

@hrkrshnn
Last active July 1, 2021 13:32
Show Gist options
  • Save hrkrshnn/7c7701e28cbcd1e495d89a850b604e56 to your computer and use it in GitHub Desktop.
Save hrkrshnn/7c7701e28cbcd1e495d89a850b604e56 to your computer and use it in GitHub Desktop.
Gas comparision between yul codegen and old codegen (with optimizer enabled). Comparing various branches.

ethereum/solidity#10286

Click for a table of gas differences

reative = (ir_optimized - legacy_optimized) / legacy_optimized * 100

File name IR-optimized Legacy-Optimized relative (%)
abiEncoderV1/abi_decode_v2_storage.sol 193182 193405 -0.115302
abiEncoderV1/abi_encode_calldata_slice.sol 1034560 873928 18.3805
abiEncoderV1/struct/struct_storage_ptr.sol 164315 162697 0.994487
abiEncoderV2/abi_encode_calldata_slice.sol 1034560 873928 18.3805
abiEncoderV2/abi_encode_v2.sol 109896 109206 0.631833
abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol 122140 112940 8.14592
abiEncoderV2/calldata_array.sol 180119 124188 45.0374
abiEncoderV2/storage_array_encoding.sol 279150 279892 -0.265102
abiencodedecode/abi_decode_simple_storage.sol 129822 130582 -0.58201
array/arrays_complex_from_and_to_storage.sol 197967 273594 -27.6421
array/byte_array_storage_layout.sol 133559 494254 -72.9777
array/byte_array_transitional_2.sol 302624 478672 -36.7784
array/bytes_length_member.sol 102890 102967 -0.0747812
array/create_memory_array.sol 140716 115494 21.8384
array/dynamic_array_cleanup.sol 534460 499648 6.9673
array/dynamic_arrays_in_storage.sol 270251 300117 -9.95145
array/dynamic_multi_array_cleanup.sol 167613 164387 1.96244
array/fixed_array_cleanup.sol 423690 425520 -0.430062
array/fixed_arrays_as_return_type.sol 123426 135699 -9.04428
array/function_array_cross_calls.sol 308053 309013 -0.310667
array/reusing_memory.sol 113539 113679 -0.123154
array/copying/array_copy_calldata_storage.sol 611371 816813 -25.1517
array/copying/array_copy_cleanup_uint128.sol 107143 105857 1.21485
array/copying/array_copy_cleanup_uint40.sol 231427 235988 -1.93273
array/copying/array_copy_clear_storage.sol 138745 137448 0.94363
array/copying/array_copy_clear_storage_packed.sol 214377 211764 1.23392
array/copying/array_copy_different_packing.sol 243969 275534 -11.4559
array/copying/array_copy_including_array.sol 4268285 3957585 7.85075
array/copying/array_copy_nested_array.sol 608706 603688 0.831224
array/copying/array_copy_storage_storage_different_base.sol 234330 235316 -0.419011
array/copying/array_copy_storage_storage_different_base_nested.sol 190244 200341 -5.03991
array/copying/array_copy_storage_storage_dynamic_dynamic.sol 264706 263160 0.587475
array/copying/array_copy_storage_storage_static_static.sol 154016 153403 0.399601
array/copying/array_copy_storage_storage_struct.sol 256334 254359 0.776462
array/copying/array_copy_storage_to_memory_nested.sol 166546 158155 5.30555
array/copying/array_copy_target_leftover.sol 210180 307826 -31.7212
array/copying/array_copy_target_leftover2.sol 104655 107000 -2.19159
array/copying/array_copy_target_simple.sol 287758 307699 -6.48068
array/copying/array_copy_target_simple_2.sol 263122 268753 -2.09523
array/copying/array_nested_memory_to_storage.sol 337896 336830 0.31648
array/copying/array_storage_multi_items_per_slot.sol 129580 125440 3.30038
array/copying/arrays_from_and_to_storage.sol 119266 123614 -3.5174
array/copying/bytes_inside_mappings.sol 266845 266902 -0.0213562
array/copying/bytes_storage_to_storage.sol 1747624 2243913 -22.1171
array/copying/calldata_array_dynamic_to_storage.sol 105004 105147 -0.136
array/copying/copy_byte_array_in_struct_to_storage.sol 172018 174188 -1.24578
array/copying/copy_byte_array_to_storage.sol 135138 134376 0.567066
array/copying/copy_function_storage_array.sol 132312 211087 -37.3187
array/copying/copy_removes_bytes_data.sol 163547 163596 -0.0299518
array/copying/memory_dyn_2d_bytes_to_storage.sol 170040 178763 -4.87965
array/copying/storage_memory_nested.sol 210030 222886 -5.76797
array/copying/storage_memory_nested_bytes.sol 197860 198137 -0.139802
array/copying/storage_memory_nested_from_pointer.sol 210030 222891 -5.77008
array/copying/storage_memory_nested_struct.sol 286923 283163 1.32786
array/copying/storage_memory_packed_dyn.sol 207268 236002 -12.1753
array/delete/bytes_delete_element.sol 513674 606411 -15.2928
array/pop/array_pop_array_transition.sol 2446995 2405396 1.7294
array/pop/array_pop_uint16_transition.sol 523823 443170 18.1991
array/pop/array_pop_uint24_transition.sol 364505 314681 15.8332
array/pop/byte_array_pop_copy_long.sol 161057 242636 -33.622
array/pop/byte_array_pop_long_storage_empty.sol 431554 533164 -19.0579
array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol 286650 366846 -21.8609
array/pop/byte_array_pop_masking_long.sol 158514 240361 -34.0517
array/push/array_push.sol 110689 110528 0.145664
array/push/array_push_nested_from_calldata.sol 115893 116699 -0.690666
array/push/array_push_packed_array.sol 111700 106362 5.01871
array/push/array_push_struct.sol 144559 188256 -23.2115
array/push/array_push_struct_from_calldata.sol 147300 146671 0.428851
array/push/byte_array_push_transition.sol 383531 552524 -30.5856
array/push/push_no_args_2d.sol 495386 367676 34.7344
array/push/push_no_args_bytes.sol 426189 415408 2.59528
constructor/arrays_in_constructors.sol 447835 436724 2.54417
constructor/bytes_in_constructors_packer.sol 306960 292281 5.02222
constructor/no_callvalue_check.sol 123072 123092 -0.016248
externalContracts/deposit_contract.sol 2074318 2200275 -5.7246
externalContracts/snark.sol 117531 100147 17.3585
externalContracts/strings.sol 3111553 3186823 -2.36191
functionCall/failed_create.sol 1033889 1002828 3.09734
functionCall/mapping_array_internal_argument.sol 109620 107981 1.51786
functionTypes/store_function.sol 102903 112116 -8.21738
immutable/multi_creation.sol 129983 127822 1.69063
inlineAssembly/keccak_yul_optimization.sol 43593 44348 -1.70244
salted_create/salted_create.sol 98438950 98438970 -2.03172e-05
salted_create/salted_create_with_value.sol 269592 287256 -6.14922
storage/packed_storage_structs_bytes.sol 142641 133280 7.02356
structs/memory_structs_nested_load.sol 111022 106281 4.46082
structs/struct_containing_bytes_copy_and_delete.sol 124142 124179 -0.0297957
structs/struct_copy.sol 206686 206628 0.0280698
structs/struct_copy_via_local.sol 104544 101306 3.19626
structs/struct_delete_storage_with_array.sol 122704 125500 -2.22789
structs/struct_memory_to_storage_function_ptr.sol 105192 105148 0.0418458
structs/structs.sol 127289 126964 0.255978
structs/calldata/calldata_struct_with_nested_array_to_storage.sol 197116 196983 0.0675185
various/destructuring_assignment.sol 239257 238582 0.282922
various/skip_dynamic_types_for_structs.sol 169485 171209 -1.00696
various/staticcall_for_view_and_pure.sol 196877285 196877231 2.74283e-05
various/swap_in_storage_overwrite.sol 101334 101282 0.0513418
viaYul/array_memory_index_access.sol 151952 152638 -0.449429
viaYul/array_storage_index_access.sol 33786138 32024655 5.5004
viaYul/array_storage_index_boundary_test.sol 1312900 1258372 4.33322
viaYul/array_storage_index_zeroed_test.sol 9467636 9135188 3.6392
viaYul/array_storage_length_access.sol 7022440 10062538 -30.212
viaYul/array_storage_push_empty.sol 1425186 1391856 2.39464
viaYul/array_storage_push_empty_length_address.sol 10675834 10220612 4.45396
viaYul/array_storage_push_pop.sol 29599646 25374036 16.6533
inheritance/inherited_function_calldata_memory_interface.sol 112021 117351 -4.54193

ethereum/solidity#11493 and ethereum/solidity#10286 combined.

Click for a table of gas differences

reative = (ir_optimized - legacy_optimized) / legacy_optimized * 100

File name IR-optimized Legacy-Optimized relative (%)
abiEncoderV1/abi_decode_v2_storage.sol 203195 203105 0.0443121
abiEncoderV1/abi_encode_calldata_slice.sol 913709 787528 16.0224
abiEncoderV1/struct/struct_storage_ptr.sol 166579 167397 -0.488659
abiEncoderV2/abi_encode_calldata_slice.sol 913709 787528 16.0224
abiEncoderV2/abi_encode_v2.sol 112977 112606 0.329467
abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol 123329 111743 10.3684
abiEncoderV2/calldata_array.sol 130393 121788 7.06556
abiEncoderV2/storage_array_encoding.sol 293486 294492 -0.341605
abiencodedecode/abi_decode_simple_storage.sol 135834 136082 -0.182243
array/arrays_complex_from_and_to_storage.sol 188850 206394 -8.50025
array/byte_array_storage_layout.sol 90082 219054 -58.8768
array/byte_array_transitional_2.sol 158852 184472 -13.8883
array/bytes_length_member.sol 110402 110567 -0.149231
array/create_memory_array.sol 124674 115494 7.94846
array/dynamic_array_cleanup.sol 520173 517048 0.604393
array/dynamic_arrays_in_storage.sol 103873 100417 3.44165
array/dynamic_multi_array_cleanup.sol 116546 120687 -3.43119
array/fixed_array_cleanup.sol 465523 467520 -0.427148
array/fixed_arrays_as_return_type.sol 108922 133299 -18.2875
array/function_array_cross_calls.sol 294665 296513 -0.623244
array/reusing_memory.sol 113067 114079 -0.887105
array/copying/array_copy_storage_storage_dyn_dyn.sol 111378 109268 1.93103
array/copying/array_copy_calldata_storage.sol 650886 694013 -6.21415
array/copying/array_copy_cleanup_uint128.sol 91512 92257 -0.807527
array/copying/array_copy_cleanup_uint40.sol 147043 153588 -4.2614
array/copying/array_copy_clear_storage.sol 134471 134548 -0.0572286
array/copying/array_copy_clear_storage_packed.sol 183123 184564 -0.780759
array/copying/array_copy_different_packing.sol 209239 220734 -5.20763
array/copying/array_copy_including_array.sol 9132063 8930885 2.25261
array/copying/array_copy_nested_array.sol 688934 685688 0.473393
array/copying/array_copy_storage_storage_different_base.sol 225054 232816 -3.33396
array/copying/array_copy_storage_storage_different_base_nested.sol 189634 192441 -1.45863
array/copying/array_copy_storage_storage_dynamic_dynamic.sol 272027 269960 0.765669
array/copying/array_copy_storage_storage_static_dynamic.sol 123143 123208 -0.0527563
array/copying/array_copy_storage_storage_static_static.sol 236113 234103 0.858596
array/copying/array_copy_storage_storage_struct.sol 238673 237159 0.63839
array/copying/array_copy_storage_to_memory_nested.sol 160667 159955 0.445125
array/copying/array_copy_target_leftover.sol 125420 166126 -24.5031
array/copying/array_copy_target_leftover2.sol 91897 94200 -2.4448
array/copying/array_copy_target_simple.sol 293629 301999 -2.77153
array/copying/array_copy_target_simple_2.sol 273227 275453 -0.808123
array/copying/array_nested_memory_to_storage.sol 359183 359930 -0.20754
array/copying/array_storage_multi_items_per_slot.sol 131912 131940 -0.0212218
array/copying/arrays_from_and_to_storage.sol 99438 101614 -2.14144
array/copying/bytes_inside_mappings.sol 288105 288402 -0.102981
array/copying/bytes_storage_to_storage.sol 871443 1003713 -13.1781
array/copying/calldata_array_dynamic_to_storage.sol 111032 111347 -0.282899
array/copying/copy_byte_array_in_struct_to_storage.sol 287253 287342 -0.0309735
array/copying/copy_byte_array_to_storage.sol 119974 123476 -2.83618
array/copying/copy_function_storage_array.sol 125802 204987 -38.6293
array/copying/copy_removes_bytes_data.sol 177387 177496 -0.0614098
array/copying/memory_dyn_2d_bytes_to_storage.sol 128125 129363 -0.956997
array/copying/storage_memory_nested.sol 205634 211486 -2.76709
array/copying/storage_memory_nested_bytes.sol 202668 203437 -0.378004
array/copying/storage_memory_nested_from_pointer.sol 205634 211491 -2.76938
array/copying/storage_memory_nested_struct.sol 291305 290263 0.358985
array/copying/storage_memory_packed_dyn.sol 117510 120902 -2.80558
array/delete/bytes_delete_element.sol 207878 248611 -16.3842
array/pop/array_pop_array_transition.sol 2267953 2262396 0.245625
array/pop/array_pop_uint16_transition.sol 186990 178870 4.53961
array/pop/array_pop_uint24_transition.sol 158290 153281 3.26785
array/pop/byte_array_pop_copy_long.sol 110160 124136 -11.2586
array/pop/byte_array_pop_long_storage_empty.sol 181585 210964 -13.9261
array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol 142812 159446 -10.4324
array/pop/byte_array_pop_masking_long.sol 108284 123261 -12.1506
array/push/nested_bytes_push.sol 179186 180403 -0.674601
array/push/array_push.sol 110855 111128 -0.245663
array/push/array_push_nested_from_calldata.sol 112130 113499 -1.20618
array/push/array_push_packed_array.sol 91458 92062 -0.65608
array/push/array_push_struct.sol 136093 146456 -7.07585
array/push/array_push_struct_from_calldata.sol 138228 139171 -0.677584
array/push/byte_array_push_transition.sol 174728 205124 -14.8184
array/push/push_no_args_2d.sol 229252 198576 15.448
array/push/push_no_args_bytes.sol 183705 180608 1.71476
constructor/arrays_in_constructors.sol 439832 450224 -2.30818
constructor/bytes_in_constructors_packer.sol 294538 298384 -1.28894
constructor/no_callvalue_check.sol 123013 123092 -0.0641796
externalContracts/prbmath_signed.sol 2190496 2129038 2.88666
externalContracts/prbmath_unsigned.sol 2031337 1998133 1.66175
externalContracts/ramanujan_pi.sol 503581 554477 -9.1791
externalContracts/deposit_contract.sol 2041502 2266621 -9.93192
externalContracts/snark.sol 86768 83670 3.70264
externalContracts/strings.sol 2621928 3164525 -17.1462
functionCall/failed_create.sol 541546 532589 1.68178
functionCall/mapping_array_internal_argument.sol 111777 111781 -0.00357843
functionTypes/store_function.sol 98088 108916 -9.94161
immutable/multi_creation.sol 126665 125422 0.991054
inlineAssembly/keccak_yul_optimization.sol 43477 44348 -1.96401
salted_create/salted_create.sol 98438914 98438970 -5.6888e-05
salted_create/salted_create_with_value.sol 272559 287856 -5.31412
storage/packed_storage_structs_bytes.sol 133408 133480 -0.0539407
structs/memory_structs_nested_load.sol 110193 110881 -0.620485
structs/struct_containing_bytes_copy_and_delete.sol 133647 133879 -0.173291
structs/struct_copy.sol 228691 228628 0.0275557
structs/struct_copy_via_local.sol 109667 109706 -0.0355496
structs/struct_delete_storage_with_array.sol 121160 121500 -0.279835
structs/struct_memory_to_storage_function_ptr.sol 110153 110548 -0.357311
structs/structs.sol 134473 134064 0.305078
structs/calldata/calldata_struct_with_nested_array_to_storage.sol 202272 203583 -0.643963
structs/conversion/recursive_storage_memory.sol 192830 184668 4.41982
various/destructuring_assignment.sol 238761 239682 -0.384259
various/skip_dynamic_types_for_structs.sol 178668 179609 -0.523916
various/staticcall_for_view_and_pure.sol 196877247 196877193 2.74283e-05
various/swap_in_storage_overwrite.sol 109686 109682 0.00364691
viaYul/array_memory_index_access.sol 138135 152638 -9.50157
viaYul/array_storage_index_access.sol 28211923 28451855 -0.843291
viaYul/array_storage_index_boundary_test.sol 275338 226287 21.6765
viaYul/array_storage_index_zeroed_test.sol 6471980 6525888 -0.826064
viaYul/array_storage_length_access.sol 1314541 1506238 -12.7269
viaYul/array_storage_push_empty.sol 101000662 101087956 -0.0863545
viaYul/array_storage_push_empty_length_address.sol 102021114 101590812 0.423564
viaYul/array_storage_push_pop.sol 13749305 13137736 4.65506
inheritance/inherited_function_calldata_memory_interface.sol 111439 116151 -4.05679
events/event_dynamic_array_storage.sol 113638 114415 -0.679107
events/event_dynamic_array_storage_v2.sol 113638 114415 -0.679107
events/event_dynamic_nested_array_storage_v2.sol 183471 184551 -0.585204
events/event_indexed_mixed.sol 23676 23753 -0.32417
events/event_indexed_string.sol 337096 376774 -10.531
isoltestTesting/balance_other_contract.sol 383762 361512 6.15471

https://github.com/ethereum/solidity/commit/8a6a330d951b2c474338120cd4d3b5c299242c07

Click for a table of gas differences

reative = (ir_optimized - legacy_optimized) / legacy_optimized * 100

File name IR-optimized Legacy-Optimized relative (%)
abiEncoderV1/abi_decode_v2_storage.sol 203921 203105 0.401763
abiEncoderV1/abi_encode_calldata_slice.sol 1126476 787528 43.0395
abiEncoderV1/struct/struct_storage_ptr.sol 168199 167397 0.479101
abiEncoderV2/abi_encode_calldata_slice.sol 1126476 787528 43.0395
abiEncoderV2/abi_encode_v2.sol 113683 112606 0.956432
abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol 132435 111743 18.5175
abiEncoderV2/calldata_array.sol 224675 121788 84.4804
abiEncoderV2/storage_array_encoding.sol 294391 294492 -0.0342963
abiencodedecode/abi_decode_simple_storage.sol 136231 136082 0.109493
array/arrays_complex_from_and_to_storage.sol 191293 206394 -7.31659
array/byte_array_storage_layout.sol 91520 219054 -58.2203
array/byte_array_transitional_2.sol 171767 184472 -6.88722
array/bytes_length_member.sol 110570 110567 0.00271329
array/create_memory_array.sol 150997 115494 30.7401
array/dynamic_array_cleanup.sol 520998 517048 0.763952
array/dynamic_arrays_in_storage.sol 108326 100417 7.87616
array/dynamic_multi_array_cleanup.sol 124480 120687 3.14284
array/fixed_array_cleanup.sol 465878 467520 -0.351215
array/fixed_arrays_as_return_type.sol 133483 133299 0.138036
array/function_array_cross_calls.sol 337455 296513 13.8078
array/reusing_memory.sol 115243 114079 1.02035
array/copying/array_copy_calldata_storage.sol 651816 694013 -6.08015
array/copying/array_copy_cleanup_uint128.sol 92958 92257 0.759834
array/copying/array_copy_cleanup_uint40.sol 154441 153588 0.555382
array/copying/array_copy_clear_storage.sol 135505 134548 0.71127
array/copying/array_copy_clear_storage_packed.sol 185978 184564 0.76613
array/copying/array_copy_different_packing.sol 214644 220734 -2.75898
array/copying/array_copy_including_array.sol 9207813 8930885 3.10079
array/copying/array_copy_nested_array.sol 691977 685688 0.917181
array/copying/array_copy_storage_storage_different_base.sol 226467 232816 -2.72705
array/copying/array_copy_storage_storage_different_base_nested.sol 191858 192441 -0.30295
array/copying/array_copy_storage_storage_dyn_dyn.sol 111563 109268 2.10034
array/copying/array_copy_storage_storage_dynamic_dynamic.sol 272786 269960 1.04682
array/copying/array_copy_storage_storage_static_dynamic.sol 123375 123208 0.135543
array/copying/array_copy_storage_storage_static_static.sol 236656 234103 1.09055
array/copying/array_copy_storage_storage_struct.sol 240552 237159 1.43069
array/copying/array_copy_storage_to_memory_nested.sol 161991 159955 1.27286
array/copying/array_copy_target_leftover.sol 140618 166126 -15.3546
array/copying/array_copy_target_leftover2.sol 95528 94200 1.40977
array/copying/array_copy_target_simple.sol 296092 301999 -1.95597
array/copying/array_copy_target_simple_2.sol 274785 275453 -0.24251
array/copying/array_nested_memory_to_storage.sol 362229 359930 0.638735
array/copying/array_storage_multi_items_per_slot.sol 133671 131940 1.31196
array/copying/arrays_from_and_to_storage.sol 101659 101614 0.0442852
array/copying/bytes_inside_mappings.sol 288635 288402 0.08079
array/copying/bytes_storage_to_storage.sol 1054278 1003713 5.03779
array/copying/calldata_array_dynamic_to_storage.sol 111384 111347 0.0332295
array/copying/copy_byte_array_in_struct_to_storage.sol 287892 287342 0.19141
array/copying/copy_byte_array_to_storage.sol 122009 123476 -1.18809
array/copying/copy_function_storage_array.sol 127846 204987 -37.6321
array/copying/copy_removes_bytes_data.sol 177557 177496 0.034367
array/copying/memory_dyn_2d_bytes_to_storage.sol 134208 129363 3.74527
array/copying/storage_memory_nested.sol 209108 211486 -1.12442
array/copying/storage_memory_nested_bytes.sol 203063 203437 -0.183841
array/copying/storage_memory_nested_from_pointer.sol 209108 211491 -1.12676
array/copying/storage_memory_nested_struct.sol 293695 290263 1.18238
array/copying/storage_memory_packed_dyn.sol 115383 120902 -4.56485
array/delete/bytes_delete_element.sol 244579 248611 -1.62181
array/pop/array_pop_array_transition.sol 2280897 2262396 0.817761
array/pop/array_pop_uint16_transition.sol 195867 178870 9.50243
array/pop/array_pop_uint24_transition.sol 163721 153281 6.81102
array/pop/byte_array_pop_copy_long.sol 112526 124136 -9.35265
array/pop/byte_array_pop_long_storage_empty.sol 219418 210964 4.00732
array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol 150914 159446 -5.35103
array/pop/byte_array_pop_masking_long.sol 110514 123261 -10.3415
array/push/array_push.sol 111269 111128 0.126881
array/push/array_push_nested_from_calldata.sol 113684 113499 0.162997
array/push/array_push_packed_array.sol 93083 92062 1.10904
array/push/array_push_struct.sol 138070 146456 -5.72595
array/push/array_push_struct_from_calldata.sol 139798 139171 0.450525
array/push/byte_array_push_transition.sol 195787 205124 -4.55188
array/push/nested_bytes_push.sol 180067 180403 -0.18625
array/push/push_no_args_2d.sol 239758 198576 20.7387
array/push/push_no_args_bytes.sol 194029 180608 7.43101
constructor/arrays_in_constructors.sol 486618 450224 8.08353
constructor/bytes_in_constructors_packer.sol 336157 298384 12.6592
constructor/no_callvalue_check.sol 123743 123092 0.528873
externalContracts/FixedFeeRegistrar.sol 591043 537110 10.0413
externalContracts/deposit_contract.sol 2315871 2294975 0.910511
externalContracts/prbmath_signed.sol 2439714 2154710 13.227
externalContracts/prbmath_unsigned.sol 2226413 2021710 10.1252
externalContracts/ramanujan_pi.sol 657202 573768 14.5414
externalContracts/snark.sol 111439 83670 33.1887
externalContracts/strings.sol 3917465 3186823 22.927
functionCall/failed_create.sol 650308 532589 22.1032
functionCall/mapping_array_internal_argument.sol 112214 111781 0.387365
functionTypes/store_function.sol 100053 108916 -8.13746
immutable/multi_creation.sol 128980 125422 2.83682
inlineAssembly/keccak_yul_optimization.sol 43912 44348 -0.983133
salted_create/salted_create.sol 98438966 98438970 -4.06343e-06
salted_create/salted_create_with_value.sol 294879 287856 2.43976
storage/packed_storage_structs_bytes.sol 135766 133480 1.71262
structs/memory_structs_nested_load.sol 111932 110881 0.947863
structs/struct_containing_bytes_copy_and_delete.sol 133905 133879 0.0194205
structs/struct_copy.sol 229018 228628 0.170583
structs/struct_copy_via_local.sol 110223 109706 0.47126
structs/struct_delete_storage_with_array.sol 121810 121500 0.255144
structs/struct_memory_to_storage_function_ptr.sol 111180 110548 0.571697
structs/structs.sol 134859 134064 0.593
structs/calldata/calldata_struct_with_nested_array_to_storage.sol 204368 203583 0.385592
structs/conversion/recursive_storage_memory.sol 198438 184668 7.45662
various/destructuring_assignment.sol 241728 239682 0.853631
various/erc20.sol 698322 590969 18.1656
various/skip_dynamic_types_for_structs.sol 179260 179609 -0.194311
various/staticcall_for_view_and_pure.sol 196877291 196877193 4.97772e-05
various/swap_in_storage_overwrite.sol 109754 109682 0.0656443
viaYul/array_memory_index_access.sol 167357 152638 9.64308
viaYul/array_storage_index_access.sol 29246575 28451855 2.79321
viaYul/array_storage_index_boundary_test.sol 305153 226287 34.8522
viaYul/array_storage_index_zeroed_test.sol 6736586 6525888 3.22865
viaYul/array_storage_length_access.sol 1473674 1506238 -2.16194
viaYul/array_storage_push_empty.sol 101163076 101087956 0.0743115
viaYul/array_storage_push_empty_length_address.sol 102248163 101590812 0.647058
viaYul/array_storage_push_pop.sol 14269737 13137736 8.61641
inheritance/inherited_function_calldata_memory_interface.sol 118458 116151 1.98621
events/event_dynamic_array_storage.sol 115211 114415 0.695713
events/event_dynamic_array_storage_v2.sol 115211 114415 0.695713
events/event_dynamic_nested_array_storage_v2.sol 185905 184551 0.733673
events/event_indexed_mixed.sol 23685 23753 -0.28628
events/event_indexed_string.sol 368478 376774 -2.20185
isoltestTesting/balance_other_contract.sol 383762 361512 6.15471

ethereum/solidity#11493

Click for a table of gas differences

reative = (ir_optimized - legacy_optimized) / legacy_optimized * 100

File name IR-optimized Legacy-Optimized relative (%)
gas_transaction.sol 67318 66988 0.492626
gas_call.sol 23029 22835 0.849573
abiEncoderV1/abi_decode_v2_storage.sol 204081 203105 0.48054
abiEncoderV1/abi_encode_calldata_slice.sol 937073 787528 18.9892
abiEncoderV1/struct/struct_storage_ptr.sol 166704 167397 -0.413986
abiEncoderV2/abi_encode_calldata_slice.sol 937073 787528 18.9892
abiEncoderV2/abi_encode_v2.sol 113098 112606 0.436922
abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol 127054 111743 13.702
abiEncoderV2/calldata_array.sol 133946 121788 9.98292
abiEncoderV2/storage_array_encoding.sol 294404 294492 -0.029882
abiencodedecode/abi_decode_simple_storage.sol 136127 136082 0.0330683
array/arrays_complex_from_and_to_storage.sol 189863 206394 -8.00944
array/byte_array_storage_layout.sol 90990 219054 -58.4623
array/byte_array_transitional_2.sol 161154 184472 -12.6404
array/bytes_length_member.sol 110451 110567 -0.104914
array/create_memory_array.sol 128810 115494 11.5296
array/dynamic_array_cleanup.sol 520360 517048 0.640559
array/dynamic_arrays_in_storage.sol 103558 100417 3.12796
array/dynamic_multi_array_cleanup.sol 116558 120687 -3.42125
array/fixed_array_cleanup.sol 465538 467520 -0.423939
array/fixed_arrays_as_return_type.sol 116423 133299 -12.6603
array/function_array_cross_calls.sol 314380 296513 6.02571
array/reusing_memory.sol 114323 114079 0.213887
array/copying/array_copy_calldata_storage.sol 651532 694013 -6.12107
array/copying/array_copy_cleanup_uint128.sol 91272 92257 -1.06767
array/copying/array_copy_cleanup_uint40.sol 146336 153588 -4.72172
array/copying/array_copy_clear_storage.sol 134523 134548 -0.0185807
array/copying/array_copy_clear_storage_packed.sol 182673 184564 -1.02458
array/copying/array_copy_different_packing.sol 210357 220734 -4.70113
array/copying/array_copy_including_array.sol 9188880 8930885 2.8888
array/copying/array_copy_nested_array.sol 690179 685688 0.654963
array/copying/array_copy_storage_storage_different_base.sol 225242 232816 -3.25321
array/copying/array_copy_storage_storage_different_base_nested.sol 190637 192441 -0.93743
array/copying/array_copy_storage_storage_dyn_dyn.sol 111429 109268 1.97771
array/copying/array_copy_storage_storage_dynamic_dynamic.sol 272096 269960 0.791228
array/copying/array_copy_storage_storage_static_dynamic.sol 123221 123208 0.0105513
array/copying/array_copy_storage_storage_static_static.sol 236388 234103 0.976066
array/copying/array_copy_storage_storage_struct.sol 239059 237159 0.80115
array/copying/array_copy_storage_to_memory_nested.sol 160944 159955 0.618299
array/copying/array_copy_target_leftover.sol 126407 166126 -23.909
array/copying/array_copy_target_leftover2.sol 92325 94200 -1.99045
array/copying/array_copy_target_simple.sol 293911 301999 -2.67815
array/copying/array_copy_target_simple_2.sol 273418 275453 -0.738783
array/copying/array_nested_memory_to_storage.sol 359609 359930 -0.089184
array/copying/array_storage_multi_items_per_slot.sol 132265 131940 0.246324
array/copying/arrays_from_and_to_storage.sol 99934 101614 -1.65332
array/copying/bytes_inside_mappings.sol 288211 288402 -0.066227
array/copying/bytes_storage_to_storage.sol 864574 1003713 -13.8624
array/copying/calldata_array_dynamic_to_storage.sol 111103 111347 -0.219135
array/copying/copy_byte_array_in_struct_to_storage.sol 287623 287342 0.0977929
array/copying/copy_byte_array_to_storage.sol 120116 123476 -2.72118
array/copying/copy_function_storage_array.sol 126713 204987 -38.1849
array/copying/copy_removes_bytes_data.sol 177429 177496 -0.0377473
array/copying/memory_dyn_2d_bytes_to_storage.sol 128887 129363 -0.367957
array/copying/storage_memory_nested.sol 205948 211486 -2.61861
array/copying/storage_memory_nested_bytes.sol 203008 203437 -0.210876
array/copying/storage_memory_nested_from_pointer.sol 205948 211491 -2.62092
array/copying/storage_memory_nested_struct.sol 291768 290263 0.518495
array/copying/storage_memory_packed_dyn.sol 118794 120902 -1.74356
array/delete/bytes_delete_element.sol 212092 248611 -14.6892
array/pop/array_pop_array_transition.sol 2270841 2262396 0.373277
array/pop/array_pop_uint16_transition.sol 187932 178870 5.06625
array/pop/array_pop_uint24_transition.sol 159134 153281 3.81848
array/pop/byte_array_pop_copy_long.sol 111672 124136 -10.0406
array/pop/byte_array_pop_long_storage_empty.sol 184772 210964 -12.4154
array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol 146901 159446 -7.86787
array/pop/byte_array_pop_masking_long.sol 109293 123261 -11.3321
array/push/array_push.sol 110866 111128 -0.235764
array/push/array_push_nested_from_calldata.sol 112175 113499 -1.16653
array/push/array_push_packed_array.sol 91505 92062 -0.605027
array/push/array_push_struct.sol 136581 146456 -6.74264
array/push/array_push_struct_from_calldata.sol 138718 139171 -0.325499
array/push/byte_array_push_transition.sol 178770 205124 -12.8478
array/push/nested_bytes_push.sol 179269 180403 -0.628593
array/push/push_no_args_2d.sol 230986 198576 16.3212
array/push/push_no_args_bytes.sol 189335 180608 4.83201
constructor/arrays_in_constructors.sol 452561 450224 0.519075
constructor/bytes_in_constructors_packer.sol 307271 298384 2.97838
constructor/no_callvalue_check.sol 123029 123092 -0.0511812
externalContracts/deposit_contract.sol 2104209 2266621 -7.16538
externalContracts/prbmath_signed.sol 2403008 2129038 12.8683
externalContracts/prbmath_unsigned.sol 2171444 1998133 8.67365
externalContracts/ramanujan_pi.sol 589019 554477 6.22965
externalContracts/snark.sol 89789 83670 7.31325
externalContracts/strings.sol 2876183 3164525 -9.1117
functionCall/failed_create.sol 556755 532589 4.53746
functionCall/mapping_array_internal_argument.sol 111952 111781 0.152978
functionTypes/store_function.sol 99780 108916 -8.38812
immutable/multi_creation.sol 129086 125422 2.92134
inheritance/inherited_function_calldata_memory_interface.sol 117193 116151 0.897108
inlineAssembly/keccak_yul_optimization.sol 43557 44348 -1.78362
salted_create/salted_create.sol 98438924 98438970 -4.67295e-05
salted_create/salted_create_with_value.sol 276235 287856 -4.03709
storage/packed_storage_structs_bytes.sol 134021 133480 0.405304
structs/memory_structs_nested_load.sol 110429 110881 -0.407644
structs/struct_containing_bytes_copy_and_delete.sol 133717 133879 -0.121005
structs/struct_copy.sol 228699 228628 0.0310548
structs/struct_copy_via_local.sol 109669 109706 -0.0337265
structs/struct_delete_storage_with_array.sol 121075 121500 -0.349794
structs/struct_memory_to_storage_function_ptr.sol 110158 110548 -0.352788
structs/structs.sol 134588 134064 0.390858
structs/calldata/calldata_struct_with_nested_array_to_storage.sol 202493 203583 -0.535408
structs/conversion/recursive_storage_memory.sol 195015 184668 5.60303
various/destructuring_assignment.sol 239570 239682 -0.0467286
various/skip_dynamic_types_for_structs.sol 178857 179609 -0.418687
various/staticcall_for_view_and_pure.sol 196877285 196877193 4.67296e-05
various/swap_in_storage_overwrite.sol 109691 109682 0.00820554
viaYul/array_memory_index_access.sol 143528 152638 -5.96837
viaYul/array_storage_index_access.sol 28246897 28451855 -0.720368
viaYul/array_storage_index_boundary_test.sol 277846 226287 22.7848
viaYul/array_storage_index_zeroed_test.sol 6434071 6525888 -1.40697
viaYul/array_storage_length_access.sol 1326792 1506238 -11.9135
viaYul/array_storage_push_empty.sol 101007770 101087956 -0.079323
viaYul/array_storage_push_empty_length_address.sol 102045936 101590812 0.447997
viaYul/array_storage_push_pop.sol 13810557 13137736 5.12129
isoltestTesting/balance_other_contract.sol 383762 361512 6.15471
events/event_dynamic_array_storage.sol 113763 114415 -0.569855
events/event_dynamic_array_storage_v2.sol 113763 114415 -0.569855
events/event_dynamic_nested_array_storage_v2.sol 183740 184551 -0.439445
events/event_indexed_mixed.sol 23672 23753 -0.34101
events/event_indexed_string.sol 344935 376774 -8.45042
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment