laconicd/server
Emmanuel T Odeke 8333765b27
x/evm/keeper: save 24B with Go in-condition variable idiom (#828)
* x/evm/keeper: save 24B with Go in-condition variable idiom

The prior code doubly invoked (*ethereum/go-ethereum/core/types.Transaction).To()
which is quite expensive, and firstly copies 20 bytes each time, then
that gets rounded up to the proper size class/pointer alignment so on
64-bit machines 20B -> 24B.

Isolating a benchmark for this code per issue #826 shows this saves
quite a bit of bytes and some nano seconds which all count up towards
the transactions per seconds being processed:

```shell
$ benchstat before.txt after.txt
name        old time/op    new time/op    delta
CopyAddr-8    38.4ns ± 3%    19.3ns ± 3%  -49.66%  (p=0.000 n=10+10)

name        old alloc/op   new alloc/op   delta
CopyAddr-8     48.0B ± 0%     24.0B ± 0%  -50.00%  (p=0.000 n=10+10)

name        old allocs/op  new allocs/op  delta
CopyAddr-8      2.00 ± 0%      1.00 ± 0%  -50.00%  (p=0.000 n=10+10)
```

Fixes #826

* changelog

* lint

* Revert stray changes that were used in testing

* rm log

Co-authored-by: Federico Kunze Küllmer <federico.kunze94@gmail.com>
2021-12-14 00:51:36 +01:00
..
config tests: geth client wrapper (#774) 2021-11-30 10:16:40 +01:00
flags fix: gosec issues (#779) 2021-11-25 15:12:57 +00:00
json_rpc.go rpc: restructure JSON-RPC directory and rename server config (#612) 2021-10-01 14:49:22 +00:00
start.go x/evm/keeper: save 24B with Go in-condition variable idiom (#828) 2021-12-14 00:51:36 +01:00
util.go fix: homedir consistency (#561) 2021-09-15 05:27:37 -03:00