karlseguin / ccache

A golang LRU Cache for high concurrency
MIT License
1.29k stars 120 forks source link

feat: add benchmarks #89

Closed miparnisari closed 10 months ago

miparnisari commented 10 months ago

Addresses https://github.com/karlseguin/ccache/issues/24

miparnisari commented 10 months ago

Regarding error undefined: atomic.Bool (typecheck)

I don't see atomic.Bool defined in https://pkg.go.dev/sync/atomic@go1.18#pkg-types

How is this repo building at all? 🤔

EDIT: Updated to 1.19

karlseguin commented 10 months ago

Can the .idea folder be removed (possibly added to your .git/info/exclude), or if you think it's worthwhile to add for everyone, then .gitignore.

I think cover.out should also be excluded (make c used to remove the file)

miparnisari commented 10 months ago

@karlseguin i wrote the basic cases but i feel like we need more to cover more configuration scenarios. For example the number of buckets. The default is 16 but what if I set 1000, what should the effect be? More speed but more memory?

karlseguin commented 10 months ago

I think the next step would be to add some degree of concurrency, which is where the number of buckets would have an impact. More buckets will improve performance up to a point, at the cost of more memory. I'm not really sure how well Go's benchmark are for this type of more complex benchmark where you aren't just testing 1 narrow behavior though.

(A few uncommon operations, e.g. ItemCount, `DeletePrefix, are O(N) on the number of buckets, but I don't think these are worth worrying about too much).

miparnisari commented 10 months ago

@karlseguin why didn't you do a squash and merge? The git commit history looks horrible 😭 Can you fix it and force push?

image