Skip to content

Making debug message formatting disabled when debug is disabled #447

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

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

viktorklang
Copy link
Contributor

Fixes #446

@viktorklang viktorklang added this to the 1.0.3 milestone Dec 30, 2018
@viktorklang viktorklang self-assigned this Dec 30, 2018
@viktorklang
Copy link
Contributor Author

@reactive-streams/contributors Pretty non-controversial PR, so I'll merge this shortly.

@fwbrasil
Copy link

thanks for the quick fix! I've tested it and the performance is better.

I wonder if it'd be best to try a more generic solution, though. There's still a lot of string formatting because of other methods of TestEnvironment that take strings. Maybe these methods could take the format string + parameters and format only if necessary

@viktorklang
Copy link
Contributor Author

@fwbrasil You're most welcome! I'm not sure it makes 100% sense to spend a lot of effort in optimizing what is essentially only executed at test time, That being said, if you can demonstrate significant gains with non-breaking changes—I'm sure it'd be an interesting enhancement! ^^

@@ -504,7 +504,8 @@ public TestSetup apply(Long aLong) throws Throwable {

@Override
public void onSubscribe(final Subscription subscription) {
env.debug(String.format("whiteboxSubscriber::onSubscribe(%s)", subscription));
if (env.debugEnabled())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs curly braces to adhere to codebase style.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JakeWharton Good point—addressed!

@viktorklang
Copy link
Contributor Author

@reactive-streams/contributors Merging.

@viktorklang viktorklang merged commit 6cf7447 into master Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants