Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions BitFaster.Caching.Benchmarks/Lru/LruJustGetOrAdd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public class LruJustGetOrAdd
private static readonly FastConcurrentLru<int, int> fastConcurrentLru = new FastConcurrentLru<int, int>(8, 9, EqualityComparer<int>.Default);
private static readonly FastConcurrentTLru<int, int> fastConcurrentTLru = new FastConcurrentTLru<int, int>(8, 9, EqualityComparer<int>.Default, TimeSpan.FromMinutes(1));

private static readonly ICache<int, int> atomicFastLru = new ConcurrentLruBuilder<int, int>().WithConcurrencyLevel(8).WithCapacity(9).WithAtomicCreate().Build();

private static readonly int key = 1;
private static System.Runtime.Caching.MemoryCache memoryCache = System.Runtime.Caching.MemoryCache.Default;

Expand Down Expand Up @@ -78,6 +80,13 @@ public void ConcurrentLru()
concurrentLru.GetOrAdd(1, func);
}

[Benchmark()]
public void AtomicFastLru()
{
Func<int, int> func = x => x;
atomicFastLru.GetOrAdd(1, func);
}

[Benchmark()]
public void FastConcurrentTLru()
{
Expand Down