Avoid BoxesRuntime indirection in LruBoundedCache key comparison (#31356)
By restricting the key type of `LruBoundedCache` to `AnyRef`, we can avoid the indirection through `BoxesRuntime`, we remove some overhead and potentially unlock some JVM optimizations here.
This commit is contained in:
parent
146cc1af0f
commit
00c1da9944
1 changed files with 1 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ private[akka] case class CacheStatistics(entries: Int, maxProbeDistance: Int, av
|
||||||
* to kick out entires that are considered old. The implementation tries to keep the map close to full, only evicting
|
* to kick out entires that are considered old. The implementation tries to keep the map close to full, only evicting
|
||||||
* old entries when needed.
|
* old entries when needed.
|
||||||
*/
|
*/
|
||||||
private[akka] abstract class LruBoundedCache[K: ClassTag, V <: AnyRef: ClassTag](
|
private[akka] abstract class LruBoundedCache[K <: AnyRef: ClassTag, V <: AnyRef: ClassTag](
|
||||||
capacity: Int,
|
capacity: Int,
|
||||||
evictAgeThreshold: Int) {
|
evictAgeThreshold: Int) {
|
||||||
require(capacity > 0, "Capacity must be larger than zero")
|
require(capacity > 0, "Capacity must be larger than zero")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue