Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

x/evm/keeper: save 24B with Go in-condition variable idiom #828

Merged
merged 5 commits into from
Dec 13, 2021

Commits on Dec 13, 2021

  1. 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
    odeke-em committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    013ce93 View commit details
    Browse the repository at this point in the history
  2. changelog

    fedekunze authored and odeke-em committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    2aa34bc View commit details
    Browse the repository at this point in the history
  3. lint

    fedekunze authored and odeke-em committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    393ed86 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e516c3c View commit details
    Browse the repository at this point in the history
  5. rm log

    fedekunze committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    348ad0a View commit details
    Browse the repository at this point in the history