File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
4343* (x/gov) [ #18707 ] ( https://github.com/cosmos/cosmos-sdk/pull/18707 ) Improve genesis validation.
4444* (x/auth/tx) [ #18772 ] ( https://github.com/cosmos/cosmos-sdk/pull/18772 ) Remove misleading gas wanted from tx simulation failure log.
4545* (client/tx) [ #18852 ] ( https://github.com/cosmos/cosmos-sdk/pull/18852 ) Add ` WithFromName ` to tx factory.
46+ * (types) [ #18875 ] ( https://github.com/cosmos/cosmos-sdk/pull/18875 ) Speedup coins.Sort() if len(coins) <= 1
4647
4748### Bug Fixes
4849
Original file line number Diff line number Diff line change @@ -820,7 +820,12 @@ var _ sort.Interface = Coins{}
820820
821821// Sort is a helper function to sort the set of coins in-place
822822func (coins Coins ) Sort () Coins {
823- sort .Sort (coins )
823+ // sort.Sort(coins) does a costly runtime copy as part of `runtime.convTSlice`
824+ // So we avoid this heap allocation if len(coins) <= 1. In the future, we should hopefully find
825+ // a strategy to always avoid this.
826+ if len (coins ) > 1 {
827+ sort .Sort (coins )
828+ }
824829 return coins
825830}
826831
You can’t perform that action at this time.
0 commit comments