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

ARROW-3694: [Java] Avoid superfluous string creation when logging level is disabled #2894

Closed
wants to merge 2 commits into from

Conversation

zzhao0
Copy link
Contributor

@zzhao0 zzhao0 commented Nov 1, 2018

There are a few places where strings were unnecessarily created for logging purpose. For the scenario I profiled, for MessageSerializer.deserialize(), roughly 2/3 of the total CPU was spent in string.format() (inside ArrowRecordBatch)

@zzhao0 zzhao0 changed the title avoid superfluous string creation when logging level is disabled [JAVA] Avoid superfluous string creation when logging level is disabled Nov 1, 2018
@@ -82,7 +82,7 @@ protected Schema readSchema() throws IOException {
throw new InvalidArrowFileException("invalid footer length: " + footerLength);
}
long footerOffset = footerLengthOffset - footerLength;
LOGGER.debug(String.format("Footer starts at %d, length: %d", footerOffset, footerLength));
LOGGER.debug("Footer starts at %d, length: %d", footerOffset, footerLength);
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you need to use {} for logback.

@jacques-n
Copy link
Contributor

LGTM +1. Thanks for the improvements @zzhao0

Copy link
Member

@xhochy xhochy left a comment

Choose a reason for hiding this comment

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

+1, LGTM

@wesm
Copy link
Member

wesm commented Nov 2, 2018

@zzhao0 can you create a JIRA issue for this?

@jacques-n
Copy link
Contributor

Sorry @wesm, I should have noticed that missing.

@zzhao0
Copy link
Contributor Author

zzhao0 commented Nov 3, 2018

Will do. Thanks for the reminder

https://issues.apache.org/jira/browse/ARROW-3694

@zzhao0 zzhao0 changed the title [JAVA] Avoid superfluous string creation when logging level is disabled ARROW-3694: [Java] Avoid superfluous string creation when logging level is disabled Nov 3, 2018
@xhochy xhochy closed this in 729f2a4 Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants