Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lazy logging for non-constant strings #3

Open
MrBergin opened this issue Apr 23, 2020 · 2 comments
Open

Use lazy logging for non-constant strings #3

MrBergin opened this issue Apr 23, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@MrBergin
Copy link

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.

@MrBergin MrBergin changed the title Use lazy logging for non-constant string Use lazy logging for non-constant strings Apr 23, 2020
@adam-arold adam-arold added the enhancement New feature or request label May 2, 2020
@adam-arold
Copy link
Member

Thanks, @MrBergin this is a great observation! I'm gonna ad this to the next release.

@Baret
Copy link

Baret commented Mar 31, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants