This repository has been archived by the owner on Apr 4, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x/evm/keeper: use the fastest slice making idiom for Keeper.EthereumT…
…x.Logs (#827) Uses the fastest slice making idiom of creating the well known size of a slice using make([]sdk.Attribute, len(response.Logs)) for i, log := range response.Logs { txLogAttrs[i] = ... } instead of make([]sdk.Attribute, 0) for _, log := range response.Logs { txLogAttrs = append(txLogAttrs, ...) } which had a few problems: 1. Using 0 for size then appending is quite slow yet we know the exact size 2. Using append instead of indexing is slower If we examine the advisory at https://bencher.orijtech.com/perfclinic/sliceupdate/ and the verdict at https://bencher.orijtech.com/perfclinic/sliceupdate/#verdict this new scheme shows a massive improvement in that call site. Fixes #825
- Loading branch information