Skip to content

Commit

Permalink
More large cache benchmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethshackleton committed Jun 22, 2024
1 parent ca60178 commit 3129bbc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import org.openjdk.jmh.annotations.State
@State(Scope.Thread)
open class CommonCacheInput {
internal lateinit var cache: CommonLruCache<Any>
internal lateinit var largeCache: CommonLruCache<Any>

@Setup(Level.Iteration)
fun setUp() {
cache = CommonLruCache(1) {}
largeCache = CommonLruCache(64) {}
}
}

Expand All @@ -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") { "" }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import org.openjdk.jmh.annotations.State
@State(Scope.Thread)
open class StampedCacheInput {
internal lateinit var cache: StampedCache<Any>
internal lateinit var largeCache: StampedCache<Any>

@Setup(Level.Iteration)
fun setUp() {
cache = StampedCache(1) {}
largeCache = StampedCache(64) {}
}
}

Expand All @@ -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") { "" }
}
}

0 comments on commit 3129bbc

Please sign in to comment.