Skip to content

Commit

Permalink
Merge pull request #1925 from AntelopeIO/abi_serializer_perf_fix_main
Browse files Browse the repository at this point in the history
[5.0 -> main] Fix two small performance issues in abi_serializer.
  • Loading branch information
greg7mdp authored Nov 21, 2023
2 parents c5ac2d6 + ab49ad3 commit 1879cbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libraries/chain/abi_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ namespace eosio { namespace chain {
fc::raw::unpack(stream, size);
} EOS_RETHROW_EXCEPTIONS( unpack_exception, "Unable to unpack size of array '${p}'", ("p", ctx.get_path_string()) )
vector<fc::variant> vars;
vars.reserve(size);
auto h1 = ctx.push_to_path( impl::array_index_path_item{} );
for( decltype(size.value) i = 0; i < size; ++i ) {
ctx.set_array_index_of_path_back(i);
Expand Down Expand Up @@ -501,7 +502,7 @@ namespace eosio { namespace chain {
btype->second.second(var, ds, is_array(rtype), is_optional(rtype), ctx.get_yield_function());
} else if ( is_array(rtype) ) {
ctx.hint_array_type_if_in_array();
vector<fc::variant> vars = var.get_array();
const vector<fc::variant>& vars = var.get_array();
fc::raw::pack(ds, (fc::unsigned_int)vars.size());

auto h1 = ctx.push_to_path( impl::array_index_path_item{} );
Expand Down

0 comments on commit 1879cbf

Please sign in to comment.