parallelize unconditionally since the processing of each file can be expensive (IDEA-CR-47613)

GitOrigin-RevId: 7a1b344777e41c164175834b6a0341f0e074970a
This commit is contained in:
Alexey Kudravtsev
2019-05-27 13:18:59 +03:00
committed by intellij-monorepo-bot
parent 9e838347a6
commit a6d0b335f5

View File

@@ -173,16 +173,11 @@ public class JavaFunctionalExpressionSearcher extends QueryExecutorBase<PsiFunct
}
return true;
};
if (!processConcurrentlyIfTooMany(filesFirst, vFileProcessor)) return;
if (!JobLauncher.getInstance().invokeConcurrentlyUnderProgress(new ArrayList<>(filesFirst),
ProgressIndicatorProvider.getGlobalProgressIndicator(), vFileProcessor)) return;
allFiles.removeAll(filesFirst);
processConcurrentlyIfTooMany(allFiles, vFileProcessor);
}
private static boolean processConcurrentlyIfTooMany(@NotNull Set<? extends VirtualFile> files, @NotNull Processor<? super VirtualFile> processor) {
if (files.size() < 100) {
return ContainerUtil.process(files, processor);
}
return JobLauncher.getInstance().invokeConcurrentlyUnderProgress(new ArrayList<>(files), ProgressIndicatorProvider.getGlobalProgressIndicator(), processor);
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(new ArrayList<>(allFiles),
ProgressIndicatorProvider.getGlobalProgressIndicator(), vFileProcessor);
}
@NotNull