Skip to content

Remove source level query from javadoc hint. - #8417

Merged
mbien merged 1 commit into
apache:masterfrom
mbien:javadoc-hint-performance,
Apr 15, 2025
Merged

mbien merged 1 commit into
apache:masterfrom
mbien:javadoc-hint-performance,

Conversation

@mbien

@mbien mbien commented Apr 13, 2025

Copy link
Copy Markdown
Member

plus small inner loop optimization in TreeUtilities.

The javadoc hint is typically in the top three list of slowest hints in files with many elements (fields, methods etc), even without the presence of javadoc sections.

Due to its high per-file invocation count, a source level or preferences query can end up being quite expensive. Luckily the source level query wasn't even used, Preferences will be addressed separately since this is riskier and influences all hints.

eliminates all purple sections:
image

this "after" measurement contains another optimization which is not included int his PR:

before:

FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: {time=9260.76ms, invocations=60007, cancelled=false}: error-in-javadoc
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: {time=7213.45ms, invocations=10002, cancelled=false}: org.netbeans.modules.java.hints.bugs.NPECheck
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: {time=4136.70ms, invocations=60007, cancelled=false}: org.netbeans.modules.java.hints.bugs.Unused
...

after:

FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: {time=6387.72ms, invocations=10002, cancelled=false}: org.netbeans.modules.java.hints.bugs.NPECheck
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: {time=4796.10ms, invocations=60007, cancelled=false}: org.netbeans.modules.java.hints.bugs.Unused
FINE [org.netbeans.modules.java.hints.spiimpl.hints.HintsInvoker]: {time=1520.50ms, invocations=60007, cancelled=false}: error-in-javadoc
...

(note javadoc hint moved to place 3)

used https://github.com/mbien/nb-reprorepo/tree/master/performance/classes as test case

plus small inner loop optimization in TreeUtilities.

The javadoc hint is typically in the top three list of slowest hints in
files with many elements (fields, methods etc), even without the
presence of javadoc sections.

Due to its high per-file invocation count, a source level or
preferences query can end up being quite expensive. Luckily the source
level query wasn't even used, Preferences will be addressed separately.
@mbien mbien added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) performance hints ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Apr 13, 2025
@mbien mbien added this to the NB26 milestone Apr 13, 2025
@mbien
mbien requested a review from lahodaj April 13, 2025 01:29

@lahodaj lahodaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks sensible. Also note that we have CompilationInfo.getSourceVersion now, which is a much better way to get the version when CompilationInfo is available.

@mbien

mbien commented Apr 15, 2025

Copy link
Copy Markdown
Member Author

thanks for the review jan!

@mbien
mbien merged commit 93c422f into apache:master Apr 15, 2025
@mbien mbien mentioned this pull request Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) hints Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants