Skip to content

Cache the methods in an element#1645

Open
wmdietl wants to merge 3 commits intomasterfrom
methsinels
Open

Cache the methods in an element#1645
wmdietl wants to merge 3 commits intomasterfrom
methsinels

Conversation

@wmdietl
Copy link
Copy Markdown
Member

@wmdietl wmdietl commented Apr 21, 2026

This is frequent in stub parsing and was a large startup overhead.

Copilot AI review requested due to automatic review settings April 21, 2026 01:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces AnnotationFileParser startup overhead during stub parsing by caching the method list for a given TypeElement, avoiding repeated getEnclosedElements() + ElementFilter.methodsIn(...) calls.

Changes:

  • Add an LRU cache mapping TypeElement -> List<ExecutableElement> for enclosed methods.
  • Route method lookups and debug printing through the cached methodsInTypeElement(...) helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wmdietl
Copy link
Copy Markdown
Member Author

wmdietl commented Apr 21, 2026

@copilot Can you measure whether this has any performance benefit compared to CI running on master?

Copilot AI and others added 2 commits April 21, 2026 01:56
Copy link
Copy Markdown

Copilot AI commented Apr 21, 2026

@copilot Can you measure whether this has any performance benefit compared to CI running on master?

Measured against CI on master: I compared master run 24644042584 (base sha 70671f2) with this PR’s CI run 24699483394 for commit 81e637b. Completed Linux/JDK21 jobs show improvements: cftests-junit 18.75m → 17.35m (-7.5%), cftests-nonjunit 11.47m → 10.95m (-4.5%), typecheck-part1 10.95m → 10.30m (-5.9%). This suggests a real startup-time benefit. Commit: ec48c4c.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • central.sonatype.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx2g -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.4-bin/92wwslzcyst3phie3o264zltu/gradle-8.14.4/lib/gradle-daemon-main-8.14.4.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants