spare cpu cycles during indexing by not allocating tons of NonCancelableIndicator and not calculating their native hashCode

This commit is contained in:
peter
2015-11-12 14:00:02 +01:00
parent 8f1bccd442
commit 0df89408e2
2 changed files with 11 additions and 1 deletions
@@ -167,7 +167,7 @@ public class CoreProgressManager extends ProgressManager implements Disposable {
@Override
public void executeNonCancelableSection(@NotNull Runnable runnable) {
executeProcessUnderProgress(runnable, new NonCancelableIndicator());
executeProcessUnderProgress(runnable, NonCancelableIndicator.INSTANCE);
}
@Override
@@ -23,6 +23,16 @@ import com.intellij.openapi.progress.StandardProgressIndicator;
import org.jetbrains.annotations.NotNull;
class NonCancelableIndicator implements NonCancelableSection, StandardProgressIndicator {
static final NonCancelableIndicator INSTANCE = new NonCancelableIndicator() {
@Override
public int hashCode() {
return 0;
}
};
protected NonCancelableIndicator() {
}
@Override
public void done() {
ProgressIndicator currentIndicator = ProgressManager.getInstance().getProgressIndicator();