Simple performance comparison of cache libraries written in golang.
kpango/gache & hlts2/gocache not performs well, so remove them out from the benchmark list.
patrickmn/go-cache is FIFO mode, FishGoddess/cachego and patrickmn/go-cache are based on simple map with expiration (without hit rate case), and others are LRU mode.
bigcache | cachego | ecache | freecache | gcache | gocache | |
PutInt | :airplane: | :rocket: | :rocket: | :airplane: | :airplane: | |
GetInt | :airplane: | :airplane: | :rocket: | :airplane: | :airplane: | |
Put1K | :airplane: | :airplane: | :rocket: | :rocket: | :rocket: | :airplane: |
Put1M | :snail: | :rocket: | :snail: | :airplane: | :airplane: | |
PutTinyObject | :airplane: | :rocket: | :rocket: | :airplane: | ||
ChangeOutAllInt | :airplane: | :rocket: | :rocket: | :airplane: | :airplane: | |
HeavyReadInt | :rocket: | :rocket: | :rocket: | :rocket: | ||
HeavyReadIntGC | :airplane: | :rocket: | :rocket: | :airplane: | :airplane: | |
HeavyWriteInt | :rocket: | :airplane: | :rocket: | :rocket: | :airplane: | |
HeavyWriteIntGC | :rocket: | :airplane: | :airplane: | |||
HeavyWrite1K | :snail: | :airplane: | :rocket: | :rocket: | :airplane: | |
HeavyWrite1KGC | :snail: | :airplane: | :rocket: | :rocket: | :airplane: | |
HeavyMixedInt | :rocket: | :airplane: | :rocket: | :airplane: | :rocket: |
:snail: for very-slow, :airplane: for fast, :rocket: for very-fast.
256 shards * 32 items, 10s expiration
gcache
is 256 shards as default
set value
as key+1
when int
cases