forked from cerc-io/laconicd-deprecated
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
|
||
|---|---|---|
| .. | ||
| atlas | ||
| client | ||
| keeper | ||
| simulation | ||
| spec | ||
| types | ||
| genesis_test.go | ||
| genesis.go | ||
| handler_test.go | ||
| handler.go | ||
| module.go | ||