go-pulse/rlp
Felix Lange 0d076d92db
rlp: use atomic.Value for type cache (#22902)
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
CPU cache contention problems when 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.
2021-05-22 13:34:29 +02:00
..
decode_tail_test.go all: update license information 2016-04-15 09:48:05 +02:00
decode_test.go rlp: add support for optional struct fields (#22832) 2021-05-07 14:37:13 +02:00
decode.go rlp: use atomic.Value for type cache (#22902) 2021-05-22 13:34:29 +02:00
doc.go rlp: add support for optional struct fields (#22832) 2021-05-07 14:37:13 +02:00
encode_test.go rlp: use atomic.Value for type cache (#22902) 2021-05-22 13:34:29 +02:00
encode.go rlp: use atomic.Value for type cache (#22902) 2021-05-22 13:34:29 +02:00
encoder_example_test.go rlp: improve nil pointer handling (#20064) 2019-09-13 11:10:57 +02:00
iterator_test.go cmd, core, eth: background transaction indexing (#20302) 2020-05-11 18:58:43 +03:00
iterator.go core/rawdb: fix transaction indexing/unindexing hashing error (#22457) 2021-03-16 12:15:14 +02:00
raw_test.go core/types, rlp: optimize derivesha (#21728) 2020-11-04 19:29:24 +01:00
raw.go core/types, rlp: optimize derivesha (#21728) 2020-11-04 19:29:24 +01:00
typecache.go rlp: use atomic.Value for type cache (#22902) 2021-05-22 13:34:29 +02:00