Use lazy logging for non-constant strings
MrBergin opened this issue · 2 comments
There's places in Cobalt (e.g. BaseProperty.onChange
) that would benefit from switching to their lazy logging counterparts, e.g:
logger.debug("Subscribing to changes to property: $this.")
Should be
logger.debug { "Subscribing to changes to property: $this." }
I can't speak for the JVM implementation of uuid, but when looking at performance in the browser for Zircon I could see a fair chunk of time spent in uuid.toString()
and garbage collecting strings which went away when using lazy logging and turning debug off.
Thanks, @MrBergin this is a great observation! I'm gonna ad this to the next release.
I just grepped for log\w+\.\w+\(
in the whole project and there are only some logger.warn()
calls left, so this issue seems to be fixed. Especially the aforementioned call(s) in BaseProperty
are already changed.