Closed alastairtree closed 4 years ago
@alastairtree I'd like to take this - do you have any ideas of specific things you want tested? Concurrent cache access, cache reinitialization, cache eviction, simple vs complex objects?
To start with mainly just outputting the raw perf stats (CPU duration, allocations) for the primary methods such as GetOrAdd and GetOrAddAsync as was done in CacheTower so we can spot regressions and tune if required.
Beyond that duration and allocations for one or more realistic "scenarios" would be nice, such as a handful of threads reading and writing cache data concurrently with some occasional cache item expiry.
Just to give you an estimate I should be able to complete a majority of this over the coming weekend. I don't want to hinder other features that would benefit from a before/after analysis
@alastairtree I've gotten the basic set of Benchmarks finished. I opted to use the basic .NET MemoryCache as a baseline for comparisons, with the intent that we can see how far LazyCache deviates from its performance.
I'll finish the "real-world" scenarios sometime later tonight, but I wanted to give you a preview of the direction I'm taking to see if it's what you had in mind. I will not be using MemoryCache as a comparison for these integration cases, as it is not, well.. Lazy like we would need.
Looks great to me, and makes for interesting reading!
[Use the Thumbs Up reaction to vote for this feature, and please avoid adding comments like "+1" as they create noise for others watching the issue.]
Add some benchmark tests using benchmark dot net to LazyCache. See https://github.com/TurnerSoftware/CacheTower/tree/master/tests for an example and some inspiration of performance improvements. TowerCache is faster than LazyCache with fewer allocations, as documented in their repo at https://github.com/TurnerSoftware/CacheTower/blob/master/docs/Comparison.md