Repository navigation
Optimize large folder listing, filtering, sorting, and scrolling - #217
Merged
Merged
Conversation
[Medium impact] The PR appears safe to merge; the added tests address the previous finding. SummarySpeeds up large-folder browsing through faster directory reads, cached MIME checks, fewer model updates, and reused rows and tiles.
Reviews (2) · Last reviewed commit: "Add test verifying list() matches entryF..." · Reviewed by Greptile |
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.
Speeds up browsing, filtering, searching, sorting, expanding, selecting, and scrolling large folders (10,000+ entries).
Changes
src/foldermodel.h,src/foldermodel.cpp):QDirIterator/QFileInfoinlist()withopendir/readdir/fstatat, UTCQDateTimetimestamps (avoiding per-filelocaltime_r), a thread-localkindForMime()cache, and aglobs2-aware per-thread single-extension MIME cache (falling back toQMimeDatabasefor literal filenames, compound extensions, and special globs).itemCount()andsummarize()with single-passopendir/readdir(nostat(), no sorting all filenames to find the first two pictures).opendir/readdir+d_typeinsearch()to skipstat()on non-matching files, withstd::dequefor BFS traversal.CompiledFilter, cached thread-locally infits()) so filename globs and MIME inheritance aren't recomputed per file.QCollatorSortKeylazily on ties formodified,oldest,size, andkindsorts, and cache unique extension keys.src/foldermodel.h,src/foldermodel.cpp):m_pathIndexhash forindexOfPath().setExpanded()with a single O(N + R) range insert.dataChangedranges insetSelected()and coalesce contiguousdataChangedranges incountFolders().src/FileListView.qml,src/FolderGrid.qml,src/FolderList.qml,src/Band.qml,src/FileRow.qml,src/FileTile.qml,src/Format.js):reuseItems: trueinFileListView(covering Columns as well as List) andFolderGrid(resetting drag pictures onGridView.onReused).Band.qmlhit-testing to the visible index range overlapping the selection rectangle instead of scanning all items on every mouse move.rowMaskandthumbMaskoffscreenlayer.enabledonthumb.layer.enabledto avoid allocating FBO textures for rows/tiles without rounded thumbnails.Qt.locale()inFormat.jsand translate only the single unit needed inFormat.size().Benchmarks
Measured on a 10,100-entry folder (10,000 files across 12 extensions + 100 folders), Release builds:
FolderModel::list()(name)FolderModel::list()(modified)FolderModel::list()(size)FolderModel::list()(kind)FolderModel::sortEntries()(name)FolderModel::sortEntries()(modified/size)FolderModel::sortEntries()(kind)FolderModel::itemCount()FolderModel::summarize()FolderModel::search()("999")FolderModel::fits()(3 globs)