Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rlp: use atomic.Value for type cache #22902

Merged
merged 3 commits into from
May 22, 2021
Merged

Commits on May 19, 2021

  1. Configuration menu
    Copy the full SHA
    fe0202a View commit details
    Browse the repository at this point in the history
  2. rlp: use atomic.Value for type cache

    All encoding/decoding operations read the type cache to find the
    writer/decoder function responsible for a type. When analyzing CPU
    profiles of geth during sync, I found that the use of sync.RWMutex in
    cache lookups appears in the profiles. It seems we are running into
    cache contention problems because package rlp is heavily used on all CPU
    cores during sync.
    
    This change makes it use atomic.Value + a writer lock instead of
    sync.RWMutex. In the common case where the typeinfo entry is present in
    the cache, we simply fetch the map and lookup the type.
    
    Unfortunately, it is very hard to prove whether this is an improvement
    because single-threaded benchmarks won't hit the slowdown.
    fjl committed May 19, 2021
    Configuration menu
    Copy the full SHA
    b63a365 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2021

  1. Configuration menu
    Copy the full SHA
    4ee540d View commit details
    Browse the repository at this point in the history