Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
it's not a real PR but some sample code to demonstrate my idea.
First, thanks for this great project.
I'm trying to include this lib in my project and I was doing some benchmarking comparing native map vs bigcache get for bytes.
I was getting 11ns/op for native map and getting 101ns/op for bigcache on a 4,000,000 string keys. It's 10x slower than native map.
Which is pretty off from your benchmarking result:
your results indicate 1.6x slower than native map.
looking into your benchmark code, I realize this line
id := rand.Intn(maxEntryCount)
actually takes most of the time in the benchmark loop. So the current results are misleading to some degree.it's not easy to exclude certain code in the loop with timers, since the timer function is also slow compared to fast operations like map lookup. I included a baseline test to give us the time spent on the
rand.Intn
. There should be better ways to narrow down the timer to focus on our target code.try to run the sample code and you'll know what I mean.