reduce allocations and speed up StringUtil.sanitizeString#8013
Merged
npawar merged 1 commit intoapache:masterfrom Jan 13, 2022
Merged
reduce allocations and speed up StringUtil.sanitizeString#8013npawar merged 1 commit intoapache:masterfrom
npawar merged 1 commit intoapache:masterfrom
Conversation
richardstartin
commented
Jan 13, 2022
pinot-common/src/main/java/org/apache/pinot/common/utils/StringUtil.java
Outdated
Show resolved
Hide resolved
dc6a607 to
824d7aa
Compare
Codecov Report
@@ Coverage Diff @@
## master #8013 +/- ##
============================================
+ Coverage 70.34% 71.32% +0.98%
Complexity 4214 4214
============================================
Files 1596 1596
Lines 82778 82773 -5
Branches 12348 12347 -1
============================================
+ Hits 58227 59036 +809
+ Misses 20564 19742 -822
- Partials 3987 3995 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
klsince
approved these changes
Jan 13, 2022
npawar
approved these changes
Jan 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a fix for some low hanging fruit found by a user with a heavy RealtimeToOfflineTask (see #8014) - a good amount of time is spent sanitising strings.
This change makes this method more efficient (less than half the allocation when truncation is required, and no allocation when it isn't, ~2x faster) by making better use of the
StringAPI: