[Dubbo-Performance] Reduce memory allocation for URL parse#5880
Merged
chickenlj merged 8 commits intoapache:masterfrom Apr 14, 2020
Merged
Conversation
Contributor
Author
|
@chickenlj @beiwei30 PTAL |
Codecov Report
@@ Coverage Diff @@
## master #5880 +/- ##
============================================
- Coverage 61.24% 61.12% -0.13%
+ Complexity 499 495 -4
============================================
Files 981 983 +2
Lines 39142 39375 +233
Branches 5643 5675 +32
============================================
+ Hits 23973 24067 +94
- Misses 12542 12651 +109
- Partials 2627 2657 +30 Continue to review full report at Codecov.
|
Member
|
Great job. @guohao will review this change. |
guohao
reviewed
Mar 20, 2020
guohao
reviewed
Mar 20, 2020
Contributor
guohao
left a comment
There was a problem hiding this comment.
主要目标是减少 URL decode 过程中的 char[]/ String / byte[] 内存申请。
代码很工整,TempBuf的思路很好,可以减少 url decode 时的临时 char[] 和 byte[] 不断申请新内存。
基本做到了不申请多余的字符串,思路很清晰。
dubbo-common/src/main/java/org/apache/dubbo/common/utils/StringUtils.java
Outdated
Show resolved
Hide resolved
chickenlj
requested changes
Apr 3, 2020
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.
What is the purpose of the change
Reduce memory allocation for URL parse.
Brief changelog
URLStrParserto parse encodedURLString and decodedURLString.URLStrParser#parseEncodedStr(String)to replaceURL#valueOf(URL#decode(String)).URLStrParser#parseDecodedStr(String)to replaceURL#valueOf(String).URL#toMethodParameters.Verifying this change
Detail information can see: URLParseOptimize
JMH result:
Aprof result:
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests=false&mvn clean test-compile failsafe:integration-testto make sure unit-test and integration-test pass.