VictoriaMetrics / fastcache

Fast thread-safe inmemory cache for big number of entries in Go. Minimizes GC overhead
MIT License
2.11k stars 175 forks source link

possible to remove the allocations? make it 0? #57

Open superdolt opened 3 years ago

superdolt commented 3 years ago

if cant remove the big cache, maybe the normal cache? there's 2allocs/op now... is it possible to remove it?

BenchmarkBigCacheSet-4 2000 10566656 ns/op 6.20 MB/s 4660369 B/op 6 allocs/op BenchmarkBigCacheGet-4 2000 6902694 ns/op 9.49 MB/s 684169 B/op 131076 allocs/op BenchmarkBigCacheSetGet-4 1000 17579118 ns/op 7.46 MB/s 5046744 B/op 131083 allocs/op BenchmarkCacheSet-4 5000 3808874 ns/op 17.21 MB/s 1142 B/op 2 allocs/op BenchmarkCacheGet-4 5000 3293849 ns/op 19.90 MB/s 1140 B/op 2 allocs/op BenchmarkCacheSetGet-4 2000 8456061 ns/op 15.50 MB/s 2857 B/op 5 allocs/op

cristaloleg commented 3 years ago

Is this a theoretical questions or a real obstacle? Can you clarify, please.

superdolt commented 3 years ago

real obstacle. hope to have complete zero allocation to the benchmark

cristaloleg commented 3 years ago

Can you be more precise, please? What is the problem with this allocs? how bad it's for you, so...just the details to better understand the case. Thank you.

superdolt commented 3 years ago

just garbage collection? 0 alloc/ op will not have any gc