With this change, we'll get details on the number of
allocations performed by code. Later on when we have
continuous benchmarking infrastructure, this change
will prove useful to flag regressions.
Fixes#8459
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Noticed during my audit, the code for cache.CommitKVStoreCacheManager.Reset()
discarded the prior on every invocation i.e.
m = make(map[T(key)]T(value))
However, this can be made fast and conserve memory by using the map clearing idiom
that the Go compiler recognizes i.e.
for key := range m {
delete(m, key)
}
and turns into very fast code, instead of the extraneous map discarding.
The speed up generated is:
```shell
$ benchstat before after
name old time/op new time/op delta
Reset-8 204ns ± 2% 66ns ± 9% -67.86% (p=0.000 n=20+20)
name old alloc/op new alloc/op delta
Reset-8 384B ± 0% 0B -100.00% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
Reset-8 3.00 ± 0% 0.00 -100.00% (p=0.000 n=20+20)
```
Fixes#6681
* Bump Tendermint version to v0.33.0
* Deprecate old cmn package with new packages
* Update update DB APIs
* More DB updates
* Bump IAVL to v0.13.0
* Handle error returned by iavl.NewMutableTree
* Fix some IAVL stuffs
* Update IAVL
* More updates
* Passing tests
* Fix unit tests
Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>