You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2021/05/10 16:52:09 UTC
[GitHub] [logging-log4j-kotlin] rocketraman commented on a change in pull request #19: Add caching for logger lookups via interface mixin
rocketraman commented on a change in pull request #19:
URL: https://github.com/apache/logging-log4j-kotlin/pull/19#discussion_r629518466
##########
File path: log4j-api-kotlin/src/main/kotlin/org/apache/logging/log4j/kotlin/LoggingFactory.kt
##########
@@ -75,3 +81,5 @@ private fun <T : Any> unwrapCompanionClass(ofClass: Class<T>): Class<*> {
ofClass
}
}
+
+private val loggerCache = ConcurrentHashMap<Class<*>, KotlinLogger>()
Review comment:
Thanks for the link -- I've never actually come across this approach before! Doing it unsophisticated for now is probably fine -- I've committed 7783beb. Note this is a bit slower than `ConcurrentHashMap` -- the benchmarks show 14.1 ns/op vs 5 ns/op, but I think its ok. Still almost an order of magnitude better than now!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org