increase daemon reactivity when highlighting large java files

This commit is contained in:
peter
2017-03-23 15:29:10 +01:00
parent 7401004904
commit a4822b754b
3 changed files with 25 additions and 2 deletions
@@ -1688,6 +1688,8 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
long e = System.currentTimeMillis();
//System.out.println("Hi elapsed: "+(e-s));
//List<String> dumps = new ArrayList<>();
final DaemonCodeAnalyzerImpl codeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(getProject());
int N = Math.max(5, Timings.adjustAccordingToMySpeed(80, false));
System.out.println("N = " + N);
@@ -1702,12 +1704,21 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
// wait to engage all highlighting threads
return;
}
// uncomment to debug what's causing pauses
/*
AtomicBoolean finished = new AtomicBoolean();
AppExecutorUtil.getAppScheduledExecutorService().schedule(() -> {
if (!finished.get()) {
dumps.add(ThreadDumper.dumpThreadsToString());
}
}, 10, TimeUnit.MILLISECONDS);
*/
type(' ');
long end = System.currentTimeMillis();
//finished.set(true);
long interruptTime = end - now;
interruptTimes[finalI] = interruptTime;
assertTrue(codeAnalyzer.getUpdateProgress().isCanceled());
System.out.println(interruptTime);
throw new ProcessCanceledException();
};
try {
@@ -1727,6 +1738,14 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
//highlightErrors();
}
System.out.println("Interrupt times: " + Arrays.toString(interruptTimes));
/*
for (String dump : dumps) {
System.out.println("\n\n-----------------------------\n\n" + dump);
}
*/
long mean = ArrayUtil.averageAmongMedians(interruptTimes, 3);
long avg = Arrays.stream(interruptTimes).sum() / interruptTimes.length;
long max = Arrays.stream(interruptTimes).max().getAsLong();