Commit graph

1 commit

Author SHA1 Message Date
aeneasr
fc6df51032
Use ristretto to improve find performance
This patch significantly improves `v.find` performance by using
ristretto cache.

Ristretto was chosen because it is a very performant, thread-safe
cache that does not suffer form congestion or long GC pauses.

```
% go test -bench=. .
goos: darwin
goarch: amd64
pkg: github.com/spf13/viper
BenchmarkGetBool-8               5431267               211 ns/op
BenchmarkFind/cache=false-8       289495              4060 ns/op
BenchmarkFind/cache=true-8       6980976               171 ns/op
BenchmarkGet-8                   6332091               193 ns/op
BenchmarkGetBoolFromMap-8       235071828                5.09 ns/op
PASS
```
2020-09-18 13:22:31 -07:00