Skip to content

Commit 4a36892

Browse files
committed
When clearing filesets don't go through all of the directories and their files. Just the one we are looking for. 5x speed boost on scrolling through alphabetical sort.
1 parent 09d8f80 commit 4a36892

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/RageUtil_FileDB.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,15 +441,20 @@ void FilenameDB::DelFileSet( map<RString, FileSet *>::iterator dir )
441441

442442
FileSet *fs = dir->second;
443443

444-
/* Remove any stale dirp pointers. */
444+
/* Remove any stale dirp pointers. */
445445
for( map<RString, FileSet *>::iterator it = dirs.begin(); it != dirs.end(); ++it )
446446
{
447-
FileSet *Clean = it->second;
448-
for( set<File>::iterator f = Clean->files.begin(); f != Clean->files.end(); ++f )
447+
if (it->first == dir->first)
449448
{
450-
File &ff = (File &) *f;
451-
if( ff.dirp == fs )
449+
FileSet *Clean = it->second;
450+
for (set<File>::iterator f = Clean->files.begin(); f != Clean->files.end(); ++f)
451+
{
452+
File &ff = (File &)*f;
453+
if (ff.dirp == fs)
452454
ff.dirp = NULL;
455+
}
456+
457+
break;
453458
}
454459
}
455460

0 commit comments

Comments
 (0)