issue #7783: speed up explorer filter and large project tree open - #7784
Open
mattcasters wants to merge 1 commit into
Open
issue #7783: speed up explorer filter and large project tree open#7784mattcasters wants to merge 1 commit into
mattcasters wants to merge 1 commit into
Conversation
Debounce the file explorer filter, rebuild filtered trees from an in-memory index without re-running git status per keystroke, and remove the recursive hasMatchingDescendant VFS probes. Make file-type detection string/extension-map based so opening a project with thousands of files no longer performs a VFS open per plugin per entry.
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.
Summary
Fixes #7783: the File Explorer filter became unusable with a few hundred–thousand files (multi-second freezes per keystroke). The same tree rebuild path also made opening a large flat project root expensive.
Two related problems were fixed:
1. Filter keystrokes (original issue)
ExplorerTreeModel: one full VFS walk, then subsequent filter keystrokes match/render from memory onlyIExplorerRefreshListener.beforeRefresh()(no git status per character)hasMatchingDescendantVFS probes (the O(n×depth) double-walk)SearchMatcher(substring/word only)2. Project open / tree paint cost (same root causes)
HopFileTypeBase.isHandledBy: extension match is pure string — noHopVfs.getFileObjectper plugin per fileExplorerPerspectivefor O(1) type resolution; folders takeFolderFileTypevia knownisFolderflagFolderFileType/GenericFileType: no VFSisFolder/isFileprobes during type resolutionMeasured on a ~10k-file project root (git disabled): open dropped from ~10s to ~6s (~40%). Filter typing is interactive after the first index build.
Reviewer notes
Please focus review on these areas:
ExplorerPerspectivefilter pathscheduleFilterApply/applyPendingFilter/applyFilterFromModel/ensureFullTreeModelsaveTreeState/restoreTreeStatetreeModel.clear()on structuralrefresh(), show-hidden, create/delete/rename (viarefresh())getFileType(path, isFolder)+indexFileTypes()FolderFileType.isHandledBynow always returnsfalse— callers must passisFolder=trueor select the type explicitly. Search for other callers if concernedGenericFileTypeis the catch-all for unmatched files without VFSHopFileTypeBase.extractExtension/extractBaseName.gitignoreintentionally have no “extension”*.xls;*.xlsx) are split on;Git
GitGuiPlugin.getAbsoluteFilenamerefreshChangedFilesandfilePainted(both use the same string normalizer now)Out of scope / known remaining cost
TreeItems for a flat 10k root is still inherently heavy; this PR does not virtualize the treeTest plan
HopFileTypeBaseTest,ExplorerTreeModelTestFixes #7783