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

optimize: improving method format performance #1798

Merged
merged 10 commits into from
Nov 11, 2019
Merged

optimize: improving method format performance #1798

merged 10 commits into from
Nov 11, 2019

Conversation

yangfuhai
Copy link
Contributor

@yangfuhai yangfuhai commented Oct 22, 2019

Ⅰ. 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

@codecov-io
Copy link

codecov-io commented Oct 22, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@8edb5b8). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #1798   +/-   ##
==========================================
  Coverage           ?   55.28%           
  Complexity         ?     2380           
==========================================
  Files              ?      423           
  Lines              ?    14275           
  Branches           ?     1695           
==========================================
  Hits               ?     7892           
  Misses             ?     5669           
  Partials           ?      714
Impacted Files Coverage Δ Complexity Δ
...ing/annotation/GlobalTransactionalInterceptor.java 9.37% <0%> (ø) 2 <0> (?)

@xingfudeshi xingfudeshi added the first-time contributor first-time contributor label Oct 22, 2019
sb.append(", ");
}
}
return sb.append(")").toString();
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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。

Copy link
Contributor

Choose a reason for hiding this comment

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

recommended to use StringJoiner

Copy link
Contributor

@l81893521 l81893521 left a comment

Choose a reason for hiding this comment

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

Make sense. LGTM

Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

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

LGTM

@xingfudeshi xingfudeshi merged commit d98510e into apache:develop Nov 11, 2019
@slievrly slievrly added this to the 1.0 milestone Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time contributor first-time contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants