diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DelayMeter.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/DelayMeter.java deleted file mode 100644 index b427b916ee44..000000000000 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/DelayMeter.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.editor.impl; - -import gnu.trove.TLongArrayList; - -/** - * @author Pavel Fatin - */ -class DelayMeter { - private final TLongArrayList myStartTimes = new TLongArrayList(); - - private SummaryStatistics myStats = new SummaryStatistics(); - - void registerStart() { - myStartTimes.add(System.nanoTime()); - } - - void registerFinish() { - if (!myStartTimes.isEmpty()) { - long now = System.nanoTime(); - - for (int i = 0; i < myStartTimes.size(); i++) { - long elapsed = now - myStartTimes.get(i); - myStats.accept(elapsed); - } - - myStartTimes.clear(); - } - } - - void reset() { - myStats = new SummaryStatistics(); - } - - double getMin() { - return myStats.getMin(); - } - - double getMax() { - return myStats.getMax(); - } - - double getMean() { - return myStats.getMean(); - } - - double getStandardDeviation() { - return myStats.getStandardDeviation(); - } - - public String stat() { - return myStats.stat(); - } - -} - diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index d922a1a9115d..4028f8a8d9db 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -2172,8 +2172,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi paintComposedTextDecoration(g); } - - myImmediatePainter.afterPainting(); } private static final char IDEOGRAPHIC_SPACE = '\u3000'; // http://www.marathon-studios.com/unicode/U3000/Ideographic_Space diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ImmediatePainter.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ImmediatePainter.java index c0cb9ae2c520..90fefdddb430 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/ImmediatePainter.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/ImmediatePainter.java @@ -84,10 +84,6 @@ class ImmediatePainter { public static final int DEBUG_PAUSE_DURATION = 1000; - public static final String TYPING_LATENCY_STATS_KEY = "editor.typing.latency.stats"; - - private static final int TYPING_STATS_SAMPLE_SIZE = 50; - // TODO Should be removed when IDEA adopts typing without starting write actions. private static final boolean VIM_PLUGIN_LOADED = isPluginLoaded("IdeaVIM"); @@ -97,10 +93,6 @@ class ImmediatePainter { private final EditorImpl myEditor; - private int myCharsTyped; - private final DelayMeter myTypingLatencyMeter = new DelayMeter(); - private boolean myZeroLatencyTypingWasEnabled = isZeroLatencyTypingEnabled(); - ImmediatePainter(EditorImpl editor) { myEditor = editor; @@ -149,52 +141,10 @@ class ImmediatePainter { } public void paintCharacter(Graphics g, char c) { - if (isTypingLatencyStatsEnabled()) { - if (myZeroLatencyTypingWasEnabled != isZeroLatencyTypingEnabled()) { - resetTypingLatencyStats(); - myZeroLatencyTypingWasEnabled = isZeroLatencyTypingEnabled(); - } - myTypingLatencyMeter.registerStart(); - } - if (isZeroLatencyTypingEnabled() && getDocument().isWritable() && !myEditor.isViewer() && canPaintImmediately(c)) { for (Caret caret : getCaretModel().getAllCarets()) { paintImmediately(g, caret.getOffset(), c, myEditor.isInsertMode()); } - if (isTypingLatencyStatsEnabled()) { - // not all chars are painted immediately, so type usual letters / digits to compute precise stats - myTypingLatencyMeter.registerFinish(); - } - } - - if (isTypingLatencyStatsEnabled()) { - myCharsTyped++; - - if (myCharsTyped == TYPING_STATS_SAMPLE_SIZE) { - String stats = "Zero-latency: "+isZeroLatencyTypingEnabled()+"; "+myTypingLatencyMeter.stat(); - printToEventLog(stats); - - resetTypingLatencyStats(); - } - } - } - - private void printToEventLog(String message) { - NotificationGroup group = NotificationGroup.logOnlyGroup("typing-delay-stats"); - Notification notification = group.createNotification(message, NotificationType.INFORMATION); - notification.setImportant(true); - notification.notify(myEditor.getProject()); - notification.hideBalloon(); - } - - private void resetTypingLatencyStats() { - myCharsTyped = 0; - myTypingLatencyMeter.reset(); - } - - public void afterPainting() { - if (isTypingLatencyStatsEnabled()) { - myTypingLatencyMeter.registerFinish(); } } @@ -228,10 +178,6 @@ class ImmediatePainter { return Registry.is(ZERO_LATENCY_TYPING_DEBUG_KEY); } - private static boolean isTypingLatencyStatsEnabled() { - return Registry.is(TYPING_LATENCY_STATS_KEY); - } - private static boolean isPluginLoaded(@NotNull String id) { PluginId pluginId = PluginId.findId(id); if (pluginId == null) return false; diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SummaryStatistics.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SummaryStatistics.java deleted file mode 100644 index 274e7cc98509..000000000000 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SummaryStatistics.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.editor.impl; - -import gnu.trove.TDoubleArrayList; - -/** - * @author Pavel Fatin - */ -class SummaryStatistics { - private int myCount; - - private double myMin = Double.MAX_VALUE; - - private double myMax; - - private double myMean; - - private double myS; - private final TDoubleArrayList values = new TDoubleArrayList(); - - void accept(double value) { - values.add(value); - myCount++; - - myMin = Math.min(myMin, value); - - myMax = Math.max(myMax, value); - - if (myCount == 1) { - myMean = value; - } - else { - double previousMean = myMean; - myMean += (value - myMean) / myCount; - myS += (value - previousMean) * (value - myMean); - } - } - - double getMin() { - return (myMin == Double.MAX_VALUE ? 0.0D : myMin) / 1000000; - } - - double getMax() { - return myMax / 1000000; - } - - double getMean() { - return myMean / 1000000; - } - - double getStandardDeviation() { - return Math.sqrt(myS / (myCount - 1)) / 1000000; - } - - public String stat() { - values.sort(); - double median = values.get(values.size() / 2)/1000000; - return String.format("typing delay, ms: min: %5.1f | max: %5.1f | avg: %5.1f | median: %4.1f", - getMin(), getMax(), getMean(), median); - } -} diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 5d88c61fb0ee..193de0971c84 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -563,9 +563,6 @@ editor.zero.latency.typing.description=Display single-line changes immediately ( editor.zero.latency.typing.debug=false editor.zero.latency.typing.debug.description=Make 1 second pauses after immediate painting -editor.typing.latency.stats=false -editor.typing.latency.stats.description=Print typing latency (delay between key event and char painting) stats to the Event Log - editor.enable.optional.ligatures=false editor.enable.optional.ligatures.description=Enables optional ligatures supported by font in use editor.enable.optional.ligatures.restartRequired=true