FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.79k stars 5.36k forks source link

Test, benchmark and remove `local_copy_prop_prememcpy` in `memcpyopt.rs` #4600

Open vaivaswatha opened 1 year ago

vaivaswatha commented 1 year ago
  1. The optimization pass was written during the IR refactor of #4336, and uses an ad-hoc algorithm. A much more systematic (data-flow based, but not a fully data-flow analysis) algorithm was later implemented in #4592. But that does not seem to cover everything that the ad-hoc algorithm did. This needs to be investigated and the function then removed, ensuring correctness and no penalty in generated code sizes.

  2. The algorithm implemented in #4592, to optimize a sequence of memcpys, does so by optimizing pairs in a loop. This is inefficient, and can probably be done in one go.

vaivaswatha commented 1 year ago

When I worked on #4592, without local_copy_prop_prememcpy, the test u256_ops_test wouldn't compile. That was because, the new optimization inserted instructions at the beginning of the block, when the use was actually much later, thus increasing register pressure. With #4628 however, this issue is solved. u256_ops_test compiles fine now when local_copy_prop_prememcpy is removed. So we just need to benchmark and if the change is acceptable, remove it.

vaivaswatha commented 1 year ago

@IGI-111 I experiemented with removing local_copy_prop_prememcpy and here the numbers.

My suggestion is to still go ahead removing that optimization pass (because it is badly written, at that time for an immediate urgent need). We can have another tracker issue to catch what patterns of memory copy propagation we're missing and try to incorporate that into the current pass (i.e., the one added in #4592).

Impact of removing `local_copy_prop_prememcpy` test | before | after | % increase -- | -- | -- | -- should_pass/non_payable_implicit_zero_coins | 240 | 248 | 3.33333333333333 should_pass/supertraits_for_abis_ownable | 2324 | 2316 | -0.344234079173838 should_pass/forc/contract_dependencies/contract_b | 68 | 68 | 0 should_pass/forc/contract_dependencies/contract_c | 68 | 68 | 0 should_pass/forc/contract_dependencies/contract_a | 324 | 348 | 7.40740740740741 should_pass/forc/dependency_package_field | 36 | 36 | 0 should_pass/forc/dependency_patching | 36 | 36 | 0 should_pass/forc/parent_pkg_manifest/contract_a | 68 | 68 | 0 should_pass/evm/evm_basic | 36 | 36 | 0 should_pass/language/basic_func_decl | 36 | 36 | 0 should_pass/language/integer_type_inference | 788 | 788 | 0 should_pass/language/const_decl_in_library | 76 | 76 | 0 should_pass/language/mutable_arrays_struct | 156 | 156 | 0 should_pass/language/unary_not_basic | 36 | 36 | 0 should_pass/language/associated_const_trait_method | 36 | 36 | 0 should_pass/language/import_trailing_comma | 84 | 124 | 47.6190476190476 should_pass/language/struct_field_access | 92 | 92 | 0 should_pass/language/type_alias | 4328 | 4424 | 2.2181146025878 should_pass/language/mutable_arrays | 116 | 116 | 0 should_pass/language/prelude_access | 36 | 36 | 0 should_pass/language/trait_method_generic_qualified | 36 | 36 | 0 should_pass/language/generic_where_in_impl_self2 | 460 | 460 | 0 should_pass/language/array_generics | 84 | 84 | 0 should_pass/language/is_prime | 1116 | 1116 | 0 should_pass/language/out_of_order_decl | 52 | 52 | 0 should_pass/language/generic_tuple_trait | 236 | 236 | 0 should_pass/language/associated_const_impl_self | 36 | 36 | 0 should_pass/language/binary_and_hex_literals | 36 | 36 | 0 should_pass/language/chained_if_let | 172 | 204 | 18.6046511627907 should_pass/language/builtin_type_method_call | 52 | 52 | 0 should_pass/language/match_expressions_nested | 164 | 164 | 0 should_pass/language/raw_identifiers | 140 | 140 | 0 should_pass/language/struct_init_reorder | 116 | 124 | 6.89655172413793 should_pass/language/ref_mutable_fn_args_struct_assign | 92 | 92 | 0 should_pass/language/generic_enum | 36 | 36 | 0 should_pass/language/op_precedence | 36 | 36 | 0 should_pass/language/retd_struct | 120 | 128 | 6.66666666666667 should_pass/language/attributes_warnings | 36 | 36 | 0 should_pass/language/break_and_continue_block_ret | 44 | 44 | 0 should_pass/language/typeinfo_custom_callpath | 100 | 116 | 16 should_pass/language/retd_small_array | 60 | 68 | 13.3333333333333 should_pass/language/many_stack_variables | 780 | 780 | 0 should_pass/language/multi_item_import | 36 | 36 | 0 should_pass/language/ref_mutable_fn_args_struct | 84 | 84 | 0 should_pass/language/inline_if_expr_const | 36 | 36 | 0 should_pass/language/contract_caller_as_ret | 68 | 68 | 0 should_pass/language/mutable_arrays_enum | 156 | 156 | 0 should_pass/language/ref_mutable_arrays | 116 | 116 | 0 should_pass/language/tuple_in_struct | 916 | 900 | -1.74672489082969 should_pass/language/doc_comments | 84 | 84 | 0 should_pass/language/unary_not_basic_2 | 36 | 36 | 0 should_pass/language/match_expressions_simple | 340 | 332 | -2.35294117647059 should_pass/language/gtf_intrinsic | 92 | 108 | 17.3913043478261 should_pass/language/modulo_uint_test | 300 | 300 | 0 should_pass/language/ret_string_in_struct | 80 | 96 | 20 should_pass/language/smo_opcode | 112 | 112 | 0 should_pass/language/arg_demotion_inline | 68 | 68 | 0 should_pass/language/ret_small_string | 64 | 72 | 12.5 should_pass/language/match_expressions_rest | 156 | 156 | 0 should_pass/language/b256_bad_jumps | 36 | 36 | 0 should_pass/language/tuple_single_element | 108 | 132 | 22.2222222222222 should_pass/language/match_expressions_mismatched | 116 | 116 | 0 should_pass/language/basic_predicate | 36 | 36 | 0 should_pass/language/if_elseif_enum | 676 | 716 | 5.91715976331361 should_pass/language/associated_const_impl | 36 | 36 | 0 should_pass/language/associated_const_trait_const | 36 | 36 | 0 should_pass/language/implicit_return | 52 | 52 | 0 should_pass/language/generic_transpose | 868 | 860 | -0.921658986175115 should_pass/language/insert_element_reg_reuse | 4316 | 4492 | 4.07784986098239 should_pass/language/where_clause_structs | 380 | 388 | 2.10526315789474 should_pass/language/enum_variant_imports | 844 | 836 | -0.947867298578199 should_pass/language/match_expressions_with_self | 396 | 396 | 0 should_pass/language/where_clause_impls | 524 | 524 | 0 should_pass/language/enum_type_inference | 52 | 52 | 0 should_pass/language/implicit_casting | 52 | 52 | 0 should_pass/language/binop_intrinsics | 972 | 972 | 0 should_pass/language/abort_control_flow_good | 52 | 52 | 0 should_pass/language/match_expressions_structs | 212 | 228 | 7.54716981132076 should_pass/language/funcs_with_generic_types | 36 | 36 | 0 should_pass/language/typeinfo_custom_callpath2 | 100 | 116 | 16 should_pass/language/bool_and_or | 84 | 84 | 0 should_pass/language/eq_and_neq | 2188 | 2276 | 4.02193784277879 should_pass/language/const_decl_with_call_path | 364 | 392 | 7.69230769230769 should_pass/language/unit_type_variants | 60 | 68 | 13.3333333333333 should_pass/language/ops | 5212 | 5212 | 0 should_pass/language/far_jumps/many_blobs | 11640280 | 11640280 | 0 should_pass/language/far_jumps/single_blob | 1048656 | 1048656 | 0 should_pass/language/ref_mutable_fn_args_call | 60 | 60 | 0 should_pass/language/size_of | 260 | 260 | 0 should_pass/language/zero_field_types | 52 | 52 | 0 should_pass/language/asm_without_return | 60 | 60 | 0 should_pass/language/where_clause_functions | 1932 | 1940 | 0.41407867494824 should_pass/language/associated_const_impl_local_same_name | 36 | 36 | 0 should_pass/language/struct_destructuring | 204 | 220 | 7.84313725490196 should_pass/language/is_reference_type | 516 | 516 | 0 should_pass/language/reassignment_operators | 260 | 260 | 0 should_pass/language/enum_if_let_large_type | 436 | 436 | 0 should_pass/language/match_expressions_enums | 148 | 148 | 0 should_pass/language/asm_expr_basic | 284 | 284 | 0 should_pass/language/same_const_name_lib | 28 | 28 | 0 should_pass/language/associated_const_abi | 36 | 36 | 0 should_pass/language/nested_structs | 1940 | 1940 | 0 should_pass/language/retd_b256 | 128 | 136 | 6.25 should_pass/language/same_const_name | 1036 | 1036 | 0 should_pass/language/tuple_types | 52 | 52 | 0 should_pass/language/tuple_trait | 140 | 156 | 11.4285714285714 should_pass/language/associated_const_trait | 36 | 36 | 0 should_pass/language/predicate_while_dep | 68 | 68 | 0 should_pass/language/generic_impl_self_where | 2532 | 2636 | 4.10742496050553 should_pass/language/enum_if_let | 640 | 640 | 0 should_pass/language/main_returns_unit | 36 | 36 | 0 should_pass/language/tuple_indexing | 68 | 68 | 0 should_pass/language/mutable_arrays_nested | 196 | 196 | 0 should_pass/language/match_expressions_empty_enums | 52 | 52 | 0 should_pass/language/associated_const_abi_default | 36 | 36 | 0 should_pass/language/shadowing/shadowed_glob_imports | 36 | 36 | 0 should_pass/language/eq_intrinsic | 588 | 588 | 0 should_pass/language/struct_field_reassignment | 36 | 36 | 0 should_pass/language/generic_structs | 52 | 52 | 0 should_pass/language/ref_mutable_arrays_inline | 116 | 116 | 0 should_pass/language/import_with_different_callpaths | 3036 | 3100 | 2.10803689064559 should_pass/language/main_args/main_args_ref_copy | 60 | 68 | 13.3333333333333 should_pass/language/main_args/main_args_copy | 52 | 52 | 0 should_pass/language/main_args/main_args_ref_ref | 60 | 84 | 40 should_pass/language/main_args/main_args_various_types | 452 | 452 | 0 should_pass/language/main_args/main_args_empty | 52 | 52 | 0 should_pass/language/main_args/main_args_ref | 52 | 60 | 15.3846153846154 should_pass/language/main_args/main_args_copy_copy | 52 | 52 | 0 should_pass/language/prelude_access2 | 36 | 36 | 0 should_pass/language/use_full_path_names | 36 | 36 | 0 should_pass/language/typeinfo_custom_callpath_with_import | 164 | 156 | -4.87804878048781 should_pass/language/retd_zero_len_array | 44 | 44 | 0 should_pass/language/where_clause_enums | 612 | 612 | 0 should_pass/language/generic_functions | 36 | 36 | 0 should_pass/language/b256_bitwise_ops | 14292 | 15084 | 5.54156171284635 should_pass/language/mutable_and_initd | 164 | 148 | -9.75609756097561 should_pass/language/enum_in_fn_decl | 116 | 116 | 0 should_pass/language/associated_const_abi_multiple | 36 | 36 | 0 should_pass/language/valid_impurity | 68 | 68 | 0 should_pass/language/nested_while_and_if | 164 | 164 | 0 should_pass/language/mutable_arrays_multiple_nested | 172 | 172 | 0 should_pass/language/where_clause_traits | 36 | 36 | 0 should_pass/language/supertraits | 4204 | 4204 | 0 should_pass/language/match_expressions_constants | 92 | 92 | 0 should_pass/language/tuple_field_reassignment | 1188 | 1188 | 0 should_pass/language/enum_destructuring | 124 | 124 | 0 should_pass/language/revert_in_first_if_branch | 52 | 52 | 0 should_pass/language/logging | 472 | 524 | 11.0169491525424 should_pass/language/where_clause_methods | 1924 | 1932 | 0.415800415800416 should_pass/language/ref_mutable_fn_args_bool | 52 | 52 | 0 should_pass/language/diagnose_unknown_annotations | 100 | 100 | 0 should_pass/language/bitwise_not | 220 | 220 | 0 should_pass/language/generic_struct | 44 | 60 | 36.3636363636364 should_pass/language/primitive_type_argument | 52 | 52 | 0 should_pass/language/fix_opcode_bug | 52 | 52 | 0 should_pass/language/trait_method_ascription_disambiguate | 36 | 36 | 0 should_pass/language/smo | 892 | 944 | 5.82959641255605 should_pass/language/import_method_from_other_file | 508 | 548 | 7.8740157480315 should_pass/language/aliased_imports | 60 | 76 | 26.6666666666667 should_pass/language/left_to_right_func_args_evaluation | 188 | 188 | 0 should_pass/language/mutable_arrays_swap | 116 | 116 | 0 should_pass/language/break_and_continue | 780 | 780 | 0 should_pass/language/generic_type_inference | 4004 | 4020 | 0.3996003996004 should_pass/language/empty_method_initializer | 416 | 416 | 0 should_pass/language/const_inits | 3292 | 3364 | 2.18712029161604 should_pass/language/if_implicit_unit | 36 | 36 | 0 should_pass/language/enum_init_fn_call | 812 | 812 | 0 should_pass/language/complex_cfg | 524 | 540 | 3.05343511450382 should_pass/language/use_absolute_path | 36 | 36 | 0 should_pass/language/enum_padding | 116 | 132 | 13.7931034482759 should_pass/language/method_type_args | 36 | 36 | 0 should_pass/language/method_on_empty_struct | 36 | 36 | 0 should_pass/language/const_decl | 52 | 52 | 0 should_pass/language/tuple_access | 144 | 144 | 0 should_pass/language/impure_ifs | 1252 | 1412 | 12.779552715655 should_pass/language/ref_mutable_fn_args_u32 | 60 | 60 | 0 should_pass/language/match_expressions_or | 724 | 716 | -1.10497237569061 should_pass/language/trait_import_with_star | 60 | 60 | 0 should_pass/language/generic_where_in_impl_self | 460 | 460 | 0 should_pass/language/match_expressions_explicit_rets | 36 | 36 | 0 should_pass/language/while_loops | 420 | 420 | 0 should_pass/language/generics_in_contract | 608 | 672 | 10.5263157894737 should_pass/language/associated_const_trait_impl_method | 36 | 36 | 0 should_pass/language/contract_caller_dynamic_address | 144 | 160 | 11.1111111111111 should_pass/language/generic_result_method | 652 | 652 | 0 should_pass/language/local_impl_for_ord | 36 | 36 | 0 should_pass/language/match_expressions_inside_generic_functions | 540 | 540 | 0 should_pass/language/raw_ptr/vec_ret | 532 | 572 | 7.5187969924812 should_pass/language/raw_ptr/raw_ptr_ret | 348 | 348 | 0 should_pass/language/const_decl_and_use_in_library | 52 | 52 | 0 should_pass/language/predicate_while | 68 | 68 | 0 should_pass/language/test_attribute | 28 | 28 | 0 should_pass/language/numeric_constants | 380 | 380 | 0 should_pass/language/generic_impl_self | 2868 | 2860 | -0.278940027894003 should_pass/language/generic_inside_generic | 196 | 180 | -8.16326530612245 should_pass/language/match_expressions | 52 | 52 | 0 should_pass/language/associated_const_trait_default | 52 | 52 | 0 should_pass/language/generic_traits | 1492 | 1596 | 6.97050938337802 should_pass/language/self_impl_reassignment | 1140 | 1140 | 0 should_pass/language/b256_ops | 1064 | 1064 | 0 should_pass/language/associated_const_impl_multiple | 36 | 36 | 0 should_pass/language/multi_impl_self | 52 | 52 | 0 should_pass/language/array_basics | 964 | 964 | 0 should_pass/language/tuple_desugaring | 228 | 220 | -3.50877192982456 should_pass/language/non_literal_const_decl | 52 | 52 | 0 should_pass/language/supertraits_with_trait_methods | 148 | 204 | 37.8378378378378 should_pass/language/redundant_return | 36 | 36 | 0 should_pass/language/nested_struct_destructuring | 52 | 52 | 0 should_pass/language/test_multiple_attributes | 28 | 28 | 0 should_pass/language/diverging_exprs | 1932 | 1932 | 0 should_pass/language/trait_method_qualified | 260 | 260 | 0 should_pass/language/new_allocator_test | 820 | 820 | 0 should_pass/stdlib/sha256 | 556 | 556 | 0 should_pass/stdlib/u256_div_test | 14956 | 15316 | 2.40706071142017 should_pass/stdlib/result | 6912 | 6912 | 0 should_pass/stdlib/u128_mul_test | 1308 | 1420 | 8.56269113149847 should_pass/stdlib/require | 36 | 36 | 0 should_pass/stdlib/address_test | 3192 | 4040 | 26.5664160401003 should_pass/stdlib/storage_vec_insert | 1944 | 2024 | 4.11522633744856 should_pass/stdlib/eq_custom_type | 812 | 804 | -0.985221674876847 should_pass/stdlib/alloc | 780 | 780 | 0 should_pass/stdlib/u256_ops_test | 14244 | 15348 | 7.75063184498736 should_pass/stdlib/if_type_revert | 36 | 36 | 0 should_pass/stdlib/u256_test | 5108 | 5300 | 3.75880971025842 should_pass/stdlib/b512_test | 3432 | 3480 | 1.3986013986014 should_pass/stdlib/assert_eq_revert | 68 | 68 | 0 should_pass/stdlib/option | 25356 | 25212 | -0.56791292001893 should_pass/stdlib/exponentiation_test | 3028 | 3028 | 0 should_pass/stdlib/vec | 117224 | 118744 | 1.29666279942674 should_pass/stdlib/vec_swap | 26516 | 27204 | 2.59465982802836 should_pass/stdlib/assert_test | 276 | 276 | 0 should_pass/stdlib/raw_slice | 572 | 588 | 2.7972027972028 should_pass/stdlib/intrinsics | 596 | 596 | 0 should_pass/stdlib/ge_test | 388 | 388 | 0 should_pass/stdlib/u128_test | 6708 | 7052 | 5.12820512820513 should_pass/stdlib/contract_id_test | 304 | 328 | 7.89473684210526 should_pass/stdlib/contract_id_type | 732 | 828 | 13.1147540983607 should_pass/stdlib/chess | 2084 | 2084 | 0 should_pass/stdlib/raw_ptr | 1764 | 1732 | -1.8140589569161 should_pass/stdlib/u128_root_test | 6372 | 6588 | 3.38983050847458 should_pass/stdlib/logarithmic_test | 1644 | 1644 | 0 should_pass/stdlib/assert_eq | 2340 | 2400 | 2.56410256410256 should_pass/stdlib/block_height | 76 | 76 | 0 should_pass/stdlib/u256_mul_test | 7692 | 8068 | 4.88819552782111 should_pass/stdlib/eq_generic | 36 | 36 | 0 should_pass/stdlib/u128_div_test | 3388 | 3540 | 4.48642266824085 should_pass/stdlib/u128_log_test | 5924 | 6492 | 9.58811613774477 should_pass/stdlib/identity_eq | 2332 | 2636 | 13.0360205831904 should_pass/stdlib/b512_struct_alignment | 328 | 316 | -3.65853658536585 should_pass/dca/impl_trait_single | 36 | 36 | 0 should_pass/dca/multiple_fns_same_name | 36 | 36 | 0 should_pass/dca/trait_method | 36 | 36 | 0 should_pass/dca/unused_trait | 36 | 36 | 0 should_pass/dca/trait_method_neq | 116 | 116 | 0 should_pass/dca/alias_lib | 84 | 84 | 0 should_pass/dca/trait_method_lib | 28 | 28 | 0 should_pass/dca/multiple_enums_same_name | 36 | 36 | 0 should_pass/dca/contract/unused_struct_field_array | 100 | 108 | 8 should_pass/dca/contract/unused_struct_field_enum | 92 | 108 | 17.3913043478261 should_pass/dca/contract/unused_struct_field | 76 | 84 | 10.5263157894737 should_pass/dca/contract/abi_fn_params | 116 | 124 | 6.89655172413793 should_pass/dca/contract/unused_struct_field_tuple | 76 | 84 | 10.5263157894737 should_pass/dca/unused_struct | 36 | 36 | 0 should_pass/dca/unused_free_fn | 36 | 36 | 0 should_pass/dca/impl_self | 36 | 36 | 0 should_pass/dca/unused_variable | 36 | 36 | 0 should_pass/dca/all_paths_return | 36 | 36 | 0 should_pass/dca/allow_dead_code | 36 | 36 | 0 should_pass/dca/log_stdlib | 52 | 60 | 15.3846153846154 should_pass/dca/impl_self_alias2 | 36 | 36 | 0 should_pass/dca/struct_field_no_warning | 44 | 52 | 18.1818181818182 should_pass/dca/log_intrinsic | 52 | 60 | 15.3846153846154 should_pass/dca/unused_enum | 36 | 36 | 0 should_pass/dca/constant_struct | 64 | 72 | 12.5 should_pass/dca/impl_unused_fn | 60 | 68 | 13.3333333333333 should_pass/dca/library/fn_params_free | 28 | 28 | 0 should_pass/dca/library/fn_params_impl | 28 | 28 | 0 should_pass/dca/library/unused_priv_free_fn | 28 | 28 | 0 should_pass/dca/library/unused_pub_free_fn | 28 | 28 | 0 should_pass/dca/library/fn_params_trait | 28 | 28 | 0 should_pass/dca/unused_variable_in_free_fn | 36 | 36 | 0 should_pass/dca/generic_fn_trait_contraint | 36 | 36 | 0 should_pass/dca/func_param | 36 | 36 | 0 should_pass/dca/alias_type_ascription_generic | 36 | 36 | 0 should_pass/dca/alias_unused | 36 | 36 | 0 should_pass/dca/impl_trait_multiple | 36 | 36 | 0 should_pass/dca/impl_self_alias | 36 | 36 | 0 should_pass/dca/alias_type_ascription | 36 | 36 | 0 should_pass/dca/constant_decl_expr | 52 | 52 | 0 should_pass/dca/constant_while | 36 | 36 | 0 should_pass/dca/unused_fields | 36 | 36 | 0 should_pass/static_analysis/cei_pattern_violation_storage_var_read | 524 | 532 | 1.52671755725191 should_pass/static_analysis/cei_pattern_violation_in_intrinsic_call | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_tuple | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_asm_block | 240 | 248 | 3.33333333333333 should_pass/static_analysis/cei_pattern_violation_in_while_loop-4 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr | 500 | 528 | 5.6 should_pass/static_analysis/cei_pattern_violation_smo_intrinsic | 296 | 320 | 8.10810810810811 should_pass/static_analysis/cei_pattern_violation_more_complex_logic | 8276 | 8436 | 1.93330111164814 should_pass/static_analysis/cei_pattern_violation_in_struct | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_asm_block_read | 224 | 240 | 7.14285714285714 should_pass/static_analysis/cei_pattern_violation_in_while_loop-2 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_while_loop-1 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_while_loop-3 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_func_app-1 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_func_app-2 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation | 260 | 304 | 16.9230769230769 should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro | 1244 | 1272 | 2.2508038585209 should_pass/static_analysis/cei_pattern_violation_in_func_app-3 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_if_statement-2 | 260 | 288 | 10.7692307692308 should_pass/static_analysis/cei_pattern_violation_in_asm_block_bal | 212 | 228 | 7.54716981132076 should_pass/static_analysis/storage_annotations_unused_read | 68 | 68 | 0 should_pass/static_analysis/cei_pattern_violation_in_codeblocks_other_than_in_functions | 260 | 304 | 16.9230769230769 should_pass/static_analysis/cei_pattern_violation_in_asm_block_smo | 220 | 236 | 7.27272727272727 should_pass/static_analysis/cei_pattern_violation_storage_struct_read | 516 | 532 | 3.10077519379845 should_pass/static_analysis/cei_pattern_violation_storage_var_update | 452 | 476 | 5.30973451327434 should_pass/static_analysis/cei_pattern_violation_in_standalone_function | 260 | 304 | 16.9230769230769 should_pass/static_analysis/storage_annotations_unused_read_and_write | 68 | 68 | 0 should_pass/static_analysis/storage_annotations_unused_write | 68 | 68 | 0 should_pass/static_analysis/cei_pattern_violation_in_if_statement-1 | 284 | 320 | 12.6760563380282 should_pass/static_analysis/cei_pattern_violation_storage_map_and_vec | 2300 | 2332 | 1.39130434782609 should_pass/static_analysis/cei_pattern_violation_in_match_statement-1 | 652 | 724 | 11.0429447852761 should_pass/supertraits_for_abis_diamond | 68 | 68 | 0 should_pass/test_abis/abi_impl_methods_in_json_abi | 100 | 100 | 0 should_pass/test_abis/abi_impl_methods_callable | 260 | 276 | 6.15384615384615 should_pass/non_payable_zero_coins_let_binding | 240 | 248 | 3.33333333333333 should_pass/blanket_impl_u16 | 52 | 52 | 0 should_pass/multiple_supertraits_for_abis | 100 | 100 | 0 should_pass/unit_tests/contract_with_nested_libs | 164 | 164 | 0 should_pass/unit_tests/script_with_nested_libs | 132 | 132 | 0 should_pass/unit_tests/should_revert | 68 | 68 | 0 should_pass/unit_tests/predicate_multi_test | 204 | 204 | 0 should_pass/unit_tests/lib_single_test | 36 | 36 | 0 should_pass/unit_tests/regalloc_spill | 412 | 412 | 0 should_pass/unit_tests/contract_multi_test | 372 | 396 | 6.45161290322581 should_pass/unit_tests/script_multi_test | 96 | 104 | 8.33333333333333 should_pass/unit_tests/nested_libs | 124 | 124 | 0 should_pass/unit_tests/workspace_test | 96 | 104 | 8.33333333333333 should_pass/unit_tests/stack_indexing_overflow | 4012 | 3980 | -0.797607178464606 should_pass/unit_tests/predicate_with_nested_libs | 76 | 76 | 0 should_pass/unit_tests/lib_multi_test | 116 | 116 | 0 should_pass/supertraits_via_self | 36 | 36 | 0 should_pass/test_contracts/storage_configurable | 68 | 68 | 0 should_pass/test_contracts/context_testing_contract | 396 | 420 | 6.06060606060606 should_pass/test_contracts/contract_with_type_aliases | 172 | 180 | 4.65116279069768 should_pass/test_contracts/basic_storage | 11820 | 12104 | 2.40270727580372 should_pass/test_contracts/storage_access_contract | 10916 | 11124 | 1.90545987541224 should_pass/test_contracts/auth_testing_contract | 76 | 76 | 0 should_pass/test_contracts/nested_struct_args_contract | 100 | 116 | 16 should_pass/test_contracts/abi_with_tuples_contract | 108 | 108 | 0 should_pass/test_contracts/test_fuel_coin_contract | 196 | 196 | 0 should_pass/test_contracts/array_of_structs_contract | 196 | 204 | 4.08163265306122 should_pass/test_contracts/return_struct | 304 | 312 | 2.63157894736842 should_pass/test_contracts/abi_with_generic_types | 192 | 200 | 4.16666666666667 should_pass/test_contracts/balance_test_contract | 84 | 84 | 0 should_pass/test_contracts/multiple_impl | 92 | 92 | 0 should_pass/test_contracts/abi_with_same_name_types | 112 | 120 | 7.14285714285714 should_pass/test_contracts/issue_1512_repro | 1324 | 1332 | 0.604229607250755 should_pass/test_contracts/increment_contract | 828 | 836 | 0.966183574879227 should_pass/conditional_compilation/run | 52 | 52 | 0 should_pass/empty_fields_in_storage_struct | 10088 | 10520 | 4.28231562252181 should_pass/payable_non_zero_coins | 196 | 212 | 8.16326530612245 should_pass/supertraits_for_abis | 100 | 100 | 0 should_pass/blanket_impl | 52 | 52 | 0
anton-trunov commented 1 year ago

Perhaps it would make sense to run benchmarks on the projects from https://github.com/FuelLabs/sway-applications, instead of the Sway test suite?

vaivaswatha commented 1 year ago

We can have another tracker issue to catch what patterns of memory copy propagation we're missing and try to incorporate that into the current pass (i.e., the one added in #4592).

I created one (https://github.com/FuelLabs/sway/issues/4879), adding a pattern that I already know we aren't optimization. More can be added as we find them.

vaivaswatha commented 1 year ago

Perhaps it would make sense to run benchmarks on the projects from https://github.com/FuelLabs/sway-applications, instead of the Sway test suite?

Ah yes. Let me do that.

vaivaswatha commented 1 year ago

Perhaps it would make sense to run benchmarks on the projects from https://github.com/FuelLabs/sway-applications, instead of the Sway test suite?

I gave this a try, but I have trouble building most of the contracts on my local master build of Sway. Version mismatch b/w std, core and sway-libs.