cosmos-sdk/store/rootmulti
Emmanuel T Odeke 152ac24931
rootmulti/internal/maps: remove duplicated code, simplify and speed up KVPair (#6689)
Noticed during an audit, we've got duplicated code that's unused.
There were 2 type definitions:
* type kvPair types.Pair
* type KVPair types.Pair

and each had a .bytes() and .Bytes() method respectively that
then used some extra code.

This change deletes the duplicated/unnecessary code but also
while here improves the performance by removing the use of a
bytes.Buffer which is unnecessary given that we are only
length prefixed the key, length prefixing the value hence
the various helpers are unnecessary.

The added benchmarks shows the performance boost
```shell
$ benchstat before after
name           old time/op    new time/op    delta
KVPairBytes-8     146µs ± 1%     142µs ± 2%   -3.05%  (p=0.000 n=18+17)

name           old speed      new speed      delta
KVPairBytes-8  6.84GB/s ± 1%  7.06GB/s ± 2%   +3.15%  (p=0.000 n=18+17)

name           old alloc/op   new alloc/op   delta
KVPairBytes-8    1.01MB ± 0%    1.01MB ± 0%   -0.04%  (p=0.000 n=17+20)

name           old allocs/op  new allocs/op  delta
KVPairBytes-8      6.00 ± 0%      1.00 ± 0%  -83.33%  (p=0.000 n=20+20)
```

Closes: #6688
2020-07-11 13:44:10 +02:00
..
internal rootmulti/internal/maps: remove duplicated code, simplify and speed up KVPair (#6689) 2020-07-11 13:44:10 +02:00
dbadapter.go Store Refactor 1 (#2985) 2019-02-01 17:03:09 -08:00
proof.go Convert simple proof to ics23 proof (#6390) 2020-06-10 13:23:40 -04:00
proof_test.go Merge PR #6475: Pruning Refactor 2020-06-22 16:31:33 -04:00
store.go types: add ics23-tendermint to sdk (#6487) 2020-06-26 16:14:40 +00:00
store_test.go Fix nextKey bug in filteredPaginate (#6578) 2020-07-03 12:36:37 +00:00