-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
optimize: improving method format performance #1798
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1798 +/- ##
==========================================
Coverage ? 55.28%
Complexity ? 2380
==========================================
Files ? 423
Lines ? 14275
Branches ? 1695
==========================================
Hits ? 7892
Misses ? 5669
Partials ? 714
|
sb.append(", "); | ||
} | ||
} | ||
return sb.append(")").toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yangfuhai Is the performance difference from the usage of + and append?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the performance is 10 times higher than before. this is particularly important in high concurrency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collectors.joining is implemented via StringBuilder.append, so the difference comes from method.getName() + paramTypes and StringBuilder(method.getName()).append?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason for the performance gap maybe is from Arrays.stream.map vs for-loop。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommended to use StringJoiner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Ⅰ. Describe what this PR did
improving method format performance.
Ⅱ. Does this pull request fix one issue?
optimize code..
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews