diff --git a/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/CommonLruCacheBenchmark.kt b/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/CommonLruCacheBenchmark.kt index 711cee5d86..bcee577839 100644 --- a/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/CommonLruCacheBenchmark.kt +++ b/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/CommonLruCacheBenchmark.kt @@ -28,10 +28,12 @@ import org.openjdk.jmh.annotations.State @State(Scope.Thread) open class CommonCacheInput { internal lateinit var cache: CommonLruCache + internal lateinit var largeCache: CommonLruCache @Setup(Level.Iteration) fun setUp() { cache = CommonLruCache(1) {} + largeCache = CommonLruCache(64) {} } } @@ -48,4 +50,11 @@ open class CommonLruCacheBenchmark { get("1") {} get("2") {} } + + @Benchmark + @BenchmarkMode(Mode.Throughput) + fun getEntries(input: CommonCacheInput) = input.largeCache.run { + get("1") { "" } + get("2") { "" } + } } diff --git a/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/StampedCacheBenchmark.kt b/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/StampedCacheBenchmark.kt index 91d5176ebe..cb41bfef48 100644 --- a/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/StampedCacheBenchmark.kt +++ b/selekt-java/src/jmh/kotlin/com/bloomberg/selekt/cache/benchmarks/StampedCacheBenchmark.kt @@ -28,10 +28,12 @@ import org.openjdk.jmh.annotations.State @State(Scope.Thread) open class StampedCacheInput { internal lateinit var cache: StampedCache + internal lateinit var largeCache: StampedCache @Setup(Level.Iteration) fun setUp() { cache = StampedCache(1) {} + largeCache = StampedCache(64) {} } } @@ -48,4 +50,11 @@ open class StampedCacheBenchmark { get("1") {} get("2") {} } + + @Benchmark + @BenchmarkMode(Mode.Throughput) + fun getEntries(input: StampedCacheInput) = input.largeCache.run { + get("1") { "" } + get("2") { "" } + } }