mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs-ignore: optimize removeIgnoredFiles
Use HashSet instead ArrayList to store files which should be removed. Otherwise it would lead to possible ArrayList.contains in ignoredSet.removeAll in case of large removedIgnoredFilePaths. Relates to IDEA-242817. GitOrigin-RevId: c61791a5182426ee4b8ed80f96728fb4651419c7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7dfb43faa7
commit
e99d8986db
@@ -7,7 +7,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface VcsRepositoryIgnoredFilesHolder extends Disposable {
|
||||
@@ -29,7 +28,7 @@ public interface VcsRepositoryIgnoredFilesHolder extends Disposable {
|
||||
boolean containsFile(@NotNull FilePath file);
|
||||
|
||||
@NotNull
|
||||
List<FilePath> removeIgnoredFiles(@NotNull Collection<? extends FilePath> files);
|
||||
Collection<FilePath> removeIgnoredFiles(@NotNull Collection<? extends FilePath> files);
|
||||
|
||||
@NotNull
|
||||
Set<FilePath> getIgnoredFilePaths();
|
||||
|
||||
+2
-2
@@ -139,8 +139,8 @@ abstract class VcsRepositoryIgnoredFilesHolderBase<REPOSITORY : Repository>(
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeIgnoredFiles(filePaths: Collection<FilePath>): List<FilePath> {
|
||||
val removedIgnoredFilePaths = arrayListOf<FilePath>()
|
||||
override fun removeIgnoredFiles(filePaths: Collection<FilePath>): Collection<FilePath> {
|
||||
val removedIgnoredFilePaths = hashSetOf<FilePath>()
|
||||
val filePathsSet = filePaths.toHashSet()
|
||||
val ignored = SET_LOCK.read { ignoredSet.toHashSet() }
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ public class HgVFSListener extends VcsVFSListener {
|
||||
Map<VirtualFile, Collection<FilePath>> groupFilePathsByHgRoots = HgUtil.groupFilePathsByHgRoots(myProject, filePaths);
|
||||
return groupFilePathsByHgRoots.entrySet().stream()
|
||||
.map(entry -> getIgnoreRepoHolder(entry.getKey()).removeIgnoredFiles(entry.getValue()))
|
||||
.flatMap(List::stream).collect(Collectors.toList());
|
||||
.flatMap(Collection::stream).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user