Repository navigation
ADFA-6854: Check Kotlin library scope membership by root instead of per-entry sets - #2228
Draft
itsaky-adfa wants to merge 1 commit into
Draft
itsaky-adfa wants to merge 1 commit into
itsaky-adfa wants to merge 1 commit into
Conversation
|
To enable Code Reviewer, link your GitHub account to your Atlassian account. This is a one-time task that takes less than a minute. Once your account is linked, resubmit the pull request to trigger a code review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft, part 1 of 4 of the ADFA-6854 stack. The stack keeps one compact listing per library JAR shared by the Java and Kotlin LSPs, instead of four copies. Do not merge yet: see "Open items" in the top PR.
Stack (bottom to top):
JarListing: one packed index per JAR for zipfs2 and javacJarListing(needs a kt-android release)What
KtLibraryModuleno longer keeps, per library module, aSetof every entry URL (baseContentScope) or a files scope over every entryVirtualFile(computeBaseContentScope(), inherited fromAbstractKtModule). Both now go throughLibraryRootsScope. That scope holds only the module's root files and answerscontains(vf)with an ancestor-or-self walk to a root.Why
After opening CoGo's own codebase (405 library JARs, ~137k entries), the URL sets alone held 41.4 MB, ~315 B per entry, because every URL repeats the JAR path. The files scope also pinned a
VirtualFilefor every entry of every library, which keeps the Kotlin VFS from ever being lazy. PR 4 relies on that.Behaviour
jrtmodule roots.KtLibraryModuleScopeTestchecks this file by file against the old URL set.FindUsages,ScanningWorkerandDirectInheritorsProviderwalk source modules only.Measured
OnePlus Pad 2, cold open of CoGo at
stageffaa75be84, heap dump 60 s after both index markers. The numbers cover the whole stack.stageKtLibraryModulescope dataTests
KtLibraryModuleScopeTest: 4 tests. "Added later" and "holds only its roots" fail onstage.:lsp:kotlin:testV7DebugUnitTest: 633/633.