Skip to content

ADFA-6228: Stop building the per-module classpath trie - #2074

Open
itsaky-adfa wants to merge 1 commit into
perf/ADFA-6228-class-lookupfrom
perf/ADFA-6228-drop-classtrie
Open

itsaky-adfa wants to merge 1 commit into
perf/ADFA-6228-class-lookupfrom
perf/ADFA-6228-drop-classtrie

Conversation

@itsaky-adfa

@itsaky-adfa itsaky-adfa commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

ADFA-6228

4 of 4, stacked on #2073. After #2073 nothing reads ModuleProject.compileClasspathClasses, but every module still fills it on every open. This deletes the field and its fill. It is one commit, so a single revert restores the trie if a reader turns out to be missing.

Measured on a moto g34 (512 MB heap), cold open, stage + probes vs this stack:

before after
ClassTrie$Node 472,065 4,430 (boot classpath only)
String 58.3 MB 34.5 MB
Classpath indexing phase 16.6 s, 2,870 MB allocated, 10 blocking GCs 9.8 s, 1,035 MB allocated, 2 blocking GCs

A cold open of this project still runs out of memory on that device, in both builds, later on during Kotlin source indexing. That is a separate problem and is not addressed here.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.

Tip: disable this comment in your organization's Code Review settings.

@itsaky-adfa
itsaky-adfa added this pull request to stack #2077 September 25, 2026 09:16
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3240a9db-8602-4064-961e-f7dcd1ea5b8d

📥 Commits

Reviewing files that changed from the base of the PR and between 05d2ea8 and 5b98760.


📒 Files selected for processing (1)
  • lsp/java/src/test/java/com/itsaky/androidide/lsp/java/providers/completion/ImportCompletionProviderTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.



📝 Summary
  • Removed ModuleProject.compileClasspathClasses and the code that built a per-module compile-classpath trie.
  • Updated completion tests and differential-test documentation to reflect the removal.
  • The author reports these cold-open changes on a moto g34 with a 512 MB heap: classpath indexing decreased from 16.6 to 9.8 seconds, allocation from 2,870 MB to 1,035 MB, and blocking garbage collections from 10 to 2. The reported ClassTrie$Node count decreased from 472,065 to 4,430; the remaining nodes cover the boot classpath.
  • Risk: Removing the public compileClasspathClasses property may affect consumers outside this repository.
  • The author reports that cold open still runs out of memory during Kotlin source indexing on the tested device. This change does not address that issue.
  • Test results were not provided.

Walkthrough

ModuleProject no longer exposes or builds compileClasspathClasses. It still filters compile classpaths, caches canonical files, and updates Android boot classpaths. The completion test and differential-test documentation reflect the revised class-indexing setup.

Changes

Classpath Indexing

Layer / File(s) Summary
Remove classpath class indexing
subprojects/projects/src/main/java/com/itsaky/androidide/projects/api/ModuleProject.kt, lsp/java/src/test/java/com/itsaky/androidide/lsp/java/providers/completion/ImportCompletionProviderTest.kt, lsp/jvm-symbol-index/src/test/kotlin/org/appdevforall/codeonthego/indexing/jvm/*
ModuleProject removes the public compileClasspathClasses field and stops enumerating JAR classes into that index. Compile classpath filtering, canonical-file caching, and Android boot-classpath updates remain. The completion test checks for an indexed package without adding a trie entry. Differential-test documentation describes the prior trie-population process.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Suggested reviewers: jatezzz


Merge Risk

Merge Risk: ⚪ Minimal · up to 5b987

This removes unused per-module class indexing while preserving the active completion lookup. No actionable merge-blocking risk remains.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5b987

The change removes redundant classpath state without changing the traced compiler or completion inputs. No introduced security concern was established. Compatibility with undocumented callers of the removed field remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated change is bounded to module-owned class-name metadata and its preparation work. Comparing the traced base and head paths does not show expanded compiler input authority, broader lookup scope, or a new production completion caller.

Resilience and Maintainability Implications

  • inferred — The old clear-before-scan and incremental population could expose empty or partial trie state after interruption or failure. Removing that state eliminates its cleanup and concurrency obligations. Source indexing, classpath caching, boot-classpath updating, and shared-index ownership remain existing behavior; the comparison establishes no new transaction or recovery guarantee for those mechanisms.



🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: removing construction of the per-module classpath trie.
Description check Passed The description directly explains the removed field and indexing logic, provides performance measurements, and identifies the remaining out-of-scope memory issue.


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the classpath trail,
No JAR class joins the removed index.
Canonical files stay in view,
Boot classpaths remain in place.
Tests still find the indexed name,
Then hop along beneath the moon.

Comment @coderabbitai help to get the list of available commands.

@itsaky-adfa
itsaky-adfa force-pushed the perf/ADFA-6228-drop-classtrie branch from 5f67f3e to 780908a Compare October 7, 2026 13:50
@itsaky-adfa
itsaky-adfa force-pushed the perf/ADFA-6228-drop-classtrie branch from 780908a to 05d2ea8 Compare October 8, 2026 13:39
@itsaky-adfa
itsaky-adfa force-pushed the perf/ADFA-6228-drop-classtrie branch from 05d2ea8 to 765c699 Compare October 8, 2026 14:15
Class lookups now come entirely from the JVM symbol index; reverting this
commit alone restores the trie and its fill.
@itsaky-adfa
itsaky-adfa force-pushed the perf/ADFA-6228-drop-classtrie branch from 765c699 to 5b98760 Compare October 9, 2026 12:24
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.

2 participants