diff --git a/src/AsyncKeyLock.Benchmarks/BenchmarkSimpleKeyLock.cs b/src/AsyncKeyLock.Benchmarks/BenchmarkSimpleKeyLock.cs index bad10f7..88627c1 100644 --- a/src/AsyncKeyLock.Benchmarks/BenchmarkSimpleKeyLock.cs +++ b/src/AsyncKeyLock.Benchmarks/BenchmarkSimpleKeyLock.cs @@ -15,11 +15,13 @@ public void GlobalSetup() { o.PoolSize = NumberOfLocks; }); + _StripedAsyncKeyedLock = new AsyncKeyedLock.StripedAsyncKeyedLocker(NumberOfLocks); _ImageSharpWebLock = new SixLabors.ImageSharp.Web.Synchronization.AsyncKeyLock(); } private AsyncLock _AsyncKeyLock; private AsyncKeyedLock.AsyncKeyedLocker _AsyncKeyedLock; + private AsyncKeyedLock.StripedAsyncKeyedLocker _StripedAsyncKeyedLock; private SixLabors.ImageSharp.Web.Synchronization.AsyncKeyLock _ImageSharpWebLock; [Params(1_00, 1_000, 10_000)] @@ -48,6 +50,18 @@ public async Task AsyncKeyedLock() } } } + + [Benchmark] + public async Task StripedAsyncKeyedLock() + { + for (int i = 0; i < NumberOfLocks; i++) + { + using (await _StripedAsyncKeyedLock.LockAsync(string.Empty)) + { + + } + } + } [Benchmark] public async Task ImageSharpWeb() @@ -60,4 +74,4 @@ public async Task ImageSharpWeb() } } } -} \ No newline at end of file +}