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

[java] Avoid creating a new String to qualify types #126

Merged
merged 2 commits into from
Nov 20, 2016

Conversation

jsotuyod
Copy link
Member

@jsotuyod jsotuyod commented Nov 11, 2016

  • This is now slightly faster, which for a method that gets called
    over 1 million times on large projects is significant.
  • We should still look for ways to reduce the number of calls to this
    method.

This alone was enough to shave ~15% from analysis time when running the exact same test as used in #117

The baseline for PMD 5.5.2 was:

--------------------------------<<< Summary >>>--------------------------------
Segment                                         Time (secs)

Collect files:                                        0.241
Load rules:                                           0.053
Parser:                                               6.216
Symbol table:                                        16.711
RuleChain visit:                                      0.290
Reporting:                                            0.055
Rule total:                                           0.000
Rule chain rule total:                                0.000
Rule Average (0 rules):                               0.000
RuleChain Average (4 rules):                          0.216

-----------------------------<<< Final Summary >>>-----------------------------
Total                                           Time (secs)

Measured total:                                      24.432
Non-measured total:                                   0.547
Total PMD:                                           24.979

This single change produces:

--------------------------------<<< Summary >>>--------------------------------
Segment                                         Time (secs)

Collect files:                                        0.285
Load rules:                                           0.054
Parser:                                               6.106
Symbol table:                                        13.346
RuleChain visit:                                      0.275
Reporting:                                            0.051
Rule total:                                           0.000
Rule chain rule total:                                0.000
Rule Average (0 rules):                               0.000
RuleChain Average (4 rules):                          0.224

-----------------------------<<< Final Summary >>>-----------------------------
Total                                           Time (secs)

Measured total:                                      21.014
Non-measured total:                                   0.590
Total PMD:                                           21.603

All numbers are close enough to disregard measuring noise, the only significant difference is for Symbol Table being 3.4 secs faster.

 - This is now slightly faster, which for a method that gets called
    over 1 million times on large projects is significant.
 - We should still look for ways to reduce the number of calls to this
    method.
@jsotuyod jsotuyod changed the title Avoid creating a new String to qualify types [java] Avoid creating a new String to qualify types Nov 11, 2016
@adangel adangel added the for:performance The goal of this change is to improve PMD's performance label Nov 14, 2016
@adangel
Copy link
Member

adangel commented Nov 14, 2016

Wow, little change, big effect!
I think, this is small enough to also cherry-pick to 5.4.x and 5.5.x. WDYT?

@jsotuyod
Copy link
Member Author

Sure, it's small enough to be harmless, and the effect is huge, so it would be more than welcome by 5.4.x users.

@jsotuyod jsotuyod modified the milestones: 5.6.0, 5.5.3, 5.4.4 Nov 15, 2016
@adangel
Copy link
Member

adangel commented Nov 20, 2016

Thanks! I've merged it into 5.4.x, 5.5.x and master.

@adangel adangel merged commit 3a97d94 into pmd:master Nov 20, 2016
@jsotuyod jsotuyod deleted the faster-type-qualify branch November 21, 2016 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for:performance The goal of this change is to improve PMD's performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants