Skip to content

Commit

Permalink
perf: Only do memory allocation when zero coin is found (backport #10…
Browse files Browse the repository at this point in the history
…339) (#10361)

* perf: Only do memory allocation when zero coin is found (#10339)

## Description

Closes: #10333

Added a loop that checks for zero coins before making any memory allocations. If no zero coins are found, just return the `coins` slice as is. If a zero coin is found, then allocate the new array, stop looking for the first zero, and restart the loop to "remove" the 0's.
  • Loading branch information
mergify[bot] authored and daeMOn63 committed Feb 28, 2022
1 parent 9c7f292 commit bc16f21
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* [\#10262](https://github.com/cosmos/cosmos-sdk/pull/10262) Remove unnecessary logging in `x/feegrant` simulation.
* [\#10327](https://github.com/cosmos/cosmos-sdk/pull/10327) Add null guard for possible nil `Amount` in tx fee `Coins`
* [\#10339](https://github.com/cosmos/cosmos-sdk/pull/10339) Improve performance of `removeZeroCoins` by only allocating memory when necessary

### Bug Fixes

Expand Down

0 comments on commit bc16f21

Please sign in to comment.