mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
deprecate legacy scaling in performance tests
This commit is contained in:
+16
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.codeInsight.completion;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
@@ -92,7 +107,7 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas
|
||||
assertNotNull(myItems);
|
||||
LookupManager.getInstance(getProject()).hideActiveLookup();
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -110,7 +110,7 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest
|
||||
List<HighlightInfo> h = doHighlighting();
|
||||
infos.addAll(h);
|
||||
}
|
||||
}).cpuBound().usesAllCPUCores().assertTiming();
|
||||
}).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming();
|
||||
|
||||
return highlightErrors();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.codeInsight.daemon;
|
||||
|
||||
import com.intellij.psi.*;
|
||||
@@ -34,7 +49,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase{
|
||||
});
|
||||
assertEquals(N+2, n[0]);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
public void testHugeMethodChainingVisitingPerformance() throws IncorrectOperationException {
|
||||
StringBuilder text = new StringBuilder("Object s = new StringBuilder()");
|
||||
@@ -59,6 +74,6 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase{
|
||||
});
|
||||
assertEquals(N, n[0]);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1084,7 +1084,7 @@ public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
|
||||
backspace();
|
||||
infos = highlightErrors();
|
||||
assertEmpty(infos);
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -103,7 +103,7 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
public void run() throws Throwable {
|
||||
doTest(false);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testConstructorOverloadsWithDiamonds() throws Exception {
|
||||
@@ -112,7 +112,7 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
public void run() throws Throwable {
|
||||
doTest(false);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testMultipleOverloadsWithNestedGeneric() throws Exception {
|
||||
|
||||
@@ -590,10 +590,10 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
|
||||
ThrowableRunnable test = () -> assertSize(lineCount, findUsages(findModel));
|
||||
|
||||
findModel.setCustomScope(GlobalSearchScope.fileScope(psiFile));
|
||||
PlatformTestUtil.startPerformanceTest("slow", 400, test).attempts(2).cpuBound().usesAllCPUCores().assertTiming();
|
||||
PlatformTestUtil.startPerformanceTest("slow", 400, test).attempts(2).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming();
|
||||
|
||||
findModel.setCustomScope(new LocalSearchScope(psiFile));
|
||||
PlatformTestUtil.startPerformanceTest("slow", 400, test).attempts(2).cpuBound().usesAllCPUCores().assertTiming();
|
||||
PlatformTestUtil.startPerformanceTest("slow", 400, test).attempts(2).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming();
|
||||
}
|
||||
finally {
|
||||
fixture.tearDown();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -17,8 +17,6 @@
|
||||
package com.intellij.navigation;
|
||||
|
||||
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.codeInsight.navigation.GotoImplementationHandler;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -28,8 +26,6 @@ import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCase {
|
||||
|
||||
public void testMultipleImplsFromAbstractCall() throws Throwable {
|
||||
@@ -81,7 +77,7 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas
|
||||
final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
|
||||
assertEquals(3, impls.length);
|
||||
}
|
||||
}).cpuBound().usesAllCPUCores().assertTiming();
|
||||
}).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testToStringOnQualified() throws Throwable {
|
||||
@@ -111,7 +107,7 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas
|
||||
final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), file).targets;
|
||||
assertEquals(3, impls.length);
|
||||
}
|
||||
}).cpuBound().usesAllCPUCores().assertTiming();
|
||||
}).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -516,7 +516,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
|
||||
String text = FileUtil.loadFile(new File(path));
|
||||
PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", text);
|
||||
String message = "Source file size: " + text.length();
|
||||
PlatformTestUtil.startPerformanceTest(message, 2000, () -> myBuilder.buildStubTree(file)).cpuBound().assertTiming();
|
||||
PlatformTestUtil.startPerformanceTest(message, 2000, () -> myBuilder.buildStubTree(file)).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private void doTest(String source, String expected) {
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public class JavaAutoDetectIndentPerformanceTest extends AbstractIndentAutoDetec
|
||||
PlatformTestUtil
|
||||
.startPerformanceTest("Detecting indent on hot file", 40, AbstractIndentAutoDetectionTest::detectIndentOptions)
|
||||
.cpuBound()
|
||||
.assertTiming();
|
||||
.useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private static long trackTime(Runnable runnable) {
|
||||
|
||||
+3
-3
@@ -72,7 +72,7 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase {
|
||||
((FormatterImpl)FormatterEx.getInstanceEx()).formatWithoutModifications(model.getDocumentModel(), model.getRootBlock(), settings,
|
||||
settings.getIndentOptions(StdFileTypes.JAVA),
|
||||
file.getTextRange());
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testPerformance2() throws Exception {
|
||||
@@ -85,7 +85,7 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase {
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testPerformance3() throws Exception {
|
||||
@@ -105,7 +105,7 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase {
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private static void transformAllChildren(final ASTNode file) {
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class JavaSmartReformatPerformanceTest extends AbstractJavaFormatterTest
|
||||
.startPerformanceTest("Testing smart reformat on big file", 110, getReformatRunnable(file, ranges))
|
||||
.setup(getSetupRunnable(initial, document))
|
||||
.cpuBound()
|
||||
.assertTiming();
|
||||
.useLegacyScaling().assertTiming();
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -683,7 +683,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
|
||||
assertFalse(PsiDocumentManager.getInstance(myProject).isCommitted(document));
|
||||
assertEquals(range, pointer.getRange());
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
assertEquals(range, pointer.getRange());
|
||||
@@ -867,7 +867,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
|
||||
assertEquals(tag.getName().length(), TextRange.create(pointer.getPsiRange()).getLength());
|
||||
}
|
||||
PostprocessReformattingAspect.getInstance(myProject).doPostponedFormatting();
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -160,7 +160,7 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
System.out.println("write end");
|
||||
}
|
||||
reads.await();
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
finally {
|
||||
Disposer.dispose(disposable);
|
||||
|
||||
+1
-1
@@ -411,7 +411,7 @@ R_PARENTH (')')
|
||||
|
||||
CharSequence bombed = new SlowCharSequence(text)
|
||||
ThrowableRunnable cl = { LexerTestCase.printTokens(bombed, 0, new CustomFileTypeLexer(table)) } as ThrowableRunnable
|
||||
PlatformTestUtil.startPerformanceTest("slow", 10000, cl).cpuBound().assertTiming()
|
||||
PlatformTestUtil.startPerformanceTest("slow", 10000, cl).cpuBound().useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class EditorCreationPerformanceTest extends AbstractEditorTest {
|
||||
public void testOpeningEditorWithManyLines() throws Exception {
|
||||
Document document = EditorFactory.getInstance().createDocument(StringUtil.repeat(LOREM_IPSUM + '\n', 15000));
|
||||
|
||||
PlatformTestUtil.startPerformanceTest("Editor creation", 250, () -> {
|
||||
PlatformTestUtil.startPerformanceTest("Editor creation", 750, () -> {
|
||||
Editor editor = EditorFactory.getInstance().createEditor(document);
|
||||
try {
|
||||
System.out.println(editor.getContentComponent().getPreferredSize());
|
||||
|
||||
+2
-2
@@ -29,14 +29,14 @@ public class EditorPaintingPerformanceTest extends AbstractEditorTest {
|
||||
public void testScrollingThroughLongTextFile() throws Exception {
|
||||
initText(StringUtil.repeat(LOREM_IPSUM + '\n', 15000));
|
||||
|
||||
doTestScrollingPerformance("scrolling through text file with many lines", 1200);
|
||||
doTestScrollingPerformance("scrolling through text file with many lines", 3600);
|
||||
}
|
||||
|
||||
public void testScrollingThroughLongSoftWrappedLine() throws Exception {
|
||||
initText(StringUtil.repeat(LOREM_IPSUM + ' ', 15000));
|
||||
EditorTestUtil.configureSoftWraps(myEditor, EDITOR_WIDTH_PX, TEST_CHAR_WIDTH);
|
||||
|
||||
doTestScrollingPerformance("scrolling through long soft wrapped line", 1600);
|
||||
doTestScrollingPerformance("scrolling through long soft wrapped line", 4800);
|
||||
}
|
||||
|
||||
private static void doTestScrollingPerformance(String message, int expectedMs) {
|
||||
|
||||
+1
-1
@@ -1149,7 +1149,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
assertEquals(2, list.size()); // 1 line plus one exact range marker
|
||||
}
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testRangeHighlighterIteratorOrder() throws Exception {
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public class FileTypesTest extends PlatformTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testMaskToPattern() {
|
||||
|
||||
+1
-1
@@ -349,7 +349,7 @@ public class ProgressIndicatorTest extends LightPlatformTestCase {
|
||||
for (int i=0;i<100000;i++) {
|
||||
ProgressManager.getInstance().executeProcessUnderProgress(EmptyRunnable.getInstance(), indicator);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testWrapperIndicatorGotCanceledTooWhenInnerIndicatorHas() {
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -39,7 +39,7 @@ public class FileUtilPerformanceTest {
|
||||
assert canonicalPath != null && canonicalPath.length() == 18 : canonicalPath;
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -54,7 +54,7 @@ public class FileUtilPerformanceTest {
|
||||
assert canonicalPath != null && canonicalPath.length() == 8 : canonicalPath;
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -69,6 +69,6 @@ public class FileUtilPerformanceTest {
|
||||
assert !FileUtil.isAncestor(myTestPath, myCanonicalPath, true);
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -39,6 +39,6 @@ public class StringUtilPerformanceTest {
|
||||
StringUtil.containsAnyChar("XYZ", TEST_STRING);
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,10 +18,10 @@ package com.intellij.openapi.vfs
|
||||
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
|
||||
import kotlin.properties.Delegates
|
||||
import kotlin.test.assertEquals
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import kotlin.properties.Delegates
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class ArchiveFileSystemPerformanceTest : BareTestFixtureTestCase() {
|
||||
private var fs: ArchiveFileSystem by Delegates.notNull()
|
||||
@@ -38,7 +38,7 @@ class ArchiveFileSystemPerformanceTest : BareTestFixtureTestCase() {
|
||||
for (i in 0..100000) {
|
||||
assertEquals(root, fs.getRootByEntry(entry))
|
||||
}
|
||||
}).cpuBound().assertTiming()
|
||||
}).cpuBound().useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
@Test fun getLocalByEntry() {
|
||||
@@ -47,6 +47,6 @@ class ArchiveFileSystemPerformanceTest : BareTestFixtureTestCase() {
|
||||
for (i in 0..100000) {
|
||||
assertEquals(local, fs.getLocalByEntry(entry))
|
||||
}
|
||||
}).cpuBound().assertTiming()
|
||||
}).cpuBound().useLegacyScaling().assertTiming()
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -71,7 +71,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
VirtualFile child = vDir.findChild("5111.txt");
|
||||
assertEquals(theChild, child);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
|
||||
new WriteCommandAction.Simple(null) {
|
||||
@Override
|
||||
@@ -103,7 +103,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
assertSame(root, rootJar);
|
||||
}
|
||||
return true;
|
||||
})).assertTiming();
|
||||
})).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -144,13 +144,13 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
}
|
||||
};
|
||||
int time = 1200;
|
||||
PlatformTestUtil.startPerformanceTest("getParent is slow before movement", time, checkPerformance).assertTiming();
|
||||
PlatformTestUtil.startPerformanceTest("getParent is slow before movement", time, checkPerformance).useLegacyScaling().assertTiming();
|
||||
VirtualFile dir1 = vDir.createChildDirectory(this, "dir1");
|
||||
VirtualFile dir2 = vDir.createChildDirectory(this, "dir2");
|
||||
for (int i = 0; i < 13; i++) { /*13 is max length with THashMap capacity of 17, we get plenty collisions then*/
|
||||
dir1.createChildData(this, "a" + i + ".txt").move(this, dir2);
|
||||
}
|
||||
PlatformTestUtil.startPerformanceTest("getParent is slow after movement", time, checkPerformance).assertTiming();
|
||||
PlatformTestUtil.startPerformanceTest("getParent is slow after movement", time, checkPerformance).useLegacyScaling().assertTiming();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
for (int i = 0; i < 1000000; ++i) {
|
||||
file.getPath();
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+3
-3
@@ -562,7 +562,7 @@ public class VirtualFilePointerTest extends PlatformTestCase {
|
||||
myVirtualFilePointerManager.createContainer(parent);
|
||||
}
|
||||
Disposer.dispose(parent);
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private static void doVfsRefresh(File dir) {
|
||||
@@ -708,7 +708,7 @@ public class VirtualFilePointerTest extends PlatformTestCase {
|
||||
myVirtualFilePointerManager.before(events);
|
||||
myVirtualFilePointerManager.after(events);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testMultipleCreationOfTheSamePointerPerformance() throws IOException {
|
||||
@@ -721,7 +721,7 @@ public class VirtualFilePointerTest extends PlatformTestCase {
|
||||
VirtualFilePointer pointer = myVirtualFilePointerManager.create(url, disposable, listener);
|
||||
assertSame(pointer, thePointer);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testCidrConfusions() throws IOException {
|
||||
|
||||
@@ -163,6 +163,6 @@ public class IElementTypeTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
IElementType.push(old);
|
||||
}
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,6 +132,6 @@ public class TokenSetTest {
|
||||
assertFalse(set.contains(next));
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -677,7 +677,7 @@ public class NameUtilMatchingTest extends UsefulTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming()
|
||||
}).cpuBound().useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
public void testOnlyUnderscoresPerformance() {
|
||||
@@ -689,7 +689,7 @@ public class NameUtilMatchingTest extends UsefulTestCase {
|
||||
assertMatches("*" + small, big);
|
||||
assertDoesntMatch("*" + big, small);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testRepeatedLetterPerformance() {
|
||||
@@ -700,7 +700,7 @@ public class NameUtilMatchingTest extends UsefulTestCase {
|
||||
assertMatches("aaaaaaaaaaaaaaaaaaaaaaaa", big);
|
||||
assertDoesntMatch("aaaaaaaaaaaaaaaaaaaaaaaab", big);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.ui;
|
||||
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
@@ -112,7 +127,7 @@ public class FileNameSplittingTest extends TestCase {
|
||||
myPolicy.getPresentableName(FILE, j);
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private void doTest(String expected, int count) {
|
||||
|
||||
@@ -240,7 +240,7 @@ public class ContainerUtilTest extends TestCase {
|
||||
long elapsed = System.currentTimeMillis() - start;
|
||||
System.out.println("elapsed = " + elapsed);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private static void assertReallyEmpty(List<Object> my) {
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2006 JetBrains s.r.o. All Rights Reserved.
|
||||
* 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.util.io;
|
||||
|
||||
@@ -172,7 +184,7 @@ public class BTreeEnumeratorTest extends TestCase {
|
||||
stringCache.removeDeletedPairsListener(listener);
|
||||
stringCache.removeAll();
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
myEnumerator.close();
|
||||
System.out.printf("File size = %d bytes\n", myFile.length());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -268,7 +268,7 @@ public class PersistentMapTest extends PersistentMapTestBase {
|
||||
catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).ioBound().assertTiming();
|
||||
}).ioBound().useLegacyScaling().assertTiming();
|
||||
|
||||
myMap.close();
|
||||
System.out.printf("File size = %d bytes\n", myFile.length());
|
||||
@@ -301,7 +301,7 @@ public class PersistentMapTest extends PersistentMapTestBase {
|
||||
for (String string : strings) {
|
||||
myMap.remove(string);
|
||||
}
|
||||
}).assertTiming();
|
||||
}).useLegacyScaling().assertTiming();
|
||||
myMap.close();
|
||||
System.out.printf("File size = %d bytes\n", myFile.length());
|
||||
System.out
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2006 JetBrains s.r.o. All Rights Reserved.
|
||||
* 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.util.io;
|
||||
|
||||
@@ -161,7 +173,7 @@ public class StringEnumeratorTest extends TestCase {
|
||||
stringCache.removeDeletedPairsListener(listener);
|
||||
stringCache.removeAll();
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
myEnumerator.close();
|
||||
System.out.printf("File size = %d bytes\n", myFile.length());
|
||||
}
|
||||
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.structuralsearch;
|
||||
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
@@ -1917,7 +1932,7 @@ public class StructuralReplaceTest extends StructuralReplaceTestCase {
|
||||
doTest(testName, ext, message);
|
||||
}
|
||||
}
|
||||
).cpuBound().assertTiming();
|
||||
).cpuBound().useLegacyScaling().assertTiming();
|
||||
} finally {
|
||||
options.setToReformatAccordingToStyle(false);
|
||||
options.setToShortenFQN(false);
|
||||
|
||||
@@ -494,6 +494,7 @@ public class PlatformTestUtil {
|
||||
private final String message; // to print on fail
|
||||
private boolean adjustForIO = true; // true if test uses IO, timings need to be re-calibrated according to this agent disk performance
|
||||
private boolean adjustForCPU = true; // true if test uses CPU, timings need to be re-calibrated according to this agent CPU speed
|
||||
private boolean useLegacyScaling = false;
|
||||
|
||||
private TestInfo(@NotNull ThrowableRunnable test, int expectedMs, String message) {
|
||||
this.test = test;
|
||||
@@ -507,6 +508,12 @@ public class PlatformTestUtil {
|
||||
public TestInfo cpuBound() { adjustForIO = false; adjustForCPU = true; return this; }
|
||||
public TestInfo ioBound() { adjustForIO = true; adjustForCPU = false; return this; }
|
||||
public TestInfo attempts(int attempts) { this.attempts = attempts; return this; }
|
||||
/**
|
||||
* @deprecated Enables procedure for nonlinear scaling of results between different machines. This was historically enabled, but doesn't
|
||||
* seem to be meaningful, and is known to make results worse in some cases. Consider migration off this setting, recalibrating
|
||||
* expected execution time accordingly.
|
||||
*/
|
||||
public TestInfo useLegacyScaling() { useLegacyScaling = true; return this; }
|
||||
|
||||
public void assertTiming() {
|
||||
assert expectedMs != 0 : "Must call .expect() before run test";
|
||||
@@ -529,12 +536,12 @@ public class PlatformTestUtil {
|
||||
|
||||
int expectedOnMyMachine = expectedMs;
|
||||
if (adjustForCPU) {
|
||||
expectedOnMyMachine = adjust(expectedOnMyMachine, Timings.CPU_TIMING, Timings.ETALON_CPU_TIMING);
|
||||
expectedOnMyMachine = adjust(expectedOnMyMachine, Timings.CPU_TIMING, Timings.ETALON_CPU_TIMING, useLegacyScaling);
|
||||
|
||||
expectedOnMyMachine = usesAllCPUCores ? expectedOnMyMachine * 8 / JobSchedulerImpl.CORES_COUNT : expectedOnMyMachine;
|
||||
}
|
||||
if (adjustForIO) {
|
||||
expectedOnMyMachine = adjust(expectedOnMyMachine, Timings.IO_TIMING, Timings.ETALON_IO_TIMING);
|
||||
expectedOnMyMachine = adjust(expectedOnMyMachine, Timings.IO_TIMING, Timings.ETALON_IO_TIMING, useLegacyScaling);
|
||||
}
|
||||
|
||||
// Allow 10% more in case of test machine is busy.
|
||||
@@ -600,14 +607,18 @@ public class PlatformTestUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int adjust(int expectedOnMyMachine, long thisTiming, long ethanolTiming) {
|
||||
// most of our algorithms are quadratic. sad but true.
|
||||
double speed = 1.0 * thisTiming / ethanolTiming;
|
||||
double delta = speed < 1
|
||||
? 0.9 + Math.pow(speed - 0.7, 2)
|
||||
: 0.45 + Math.pow(speed - 0.25, 2);
|
||||
expectedOnMyMachine *= delta;
|
||||
return expectedOnMyMachine;
|
||||
private static int adjust(int expectedOnMyMachine, long thisTiming, long etalonTiming, boolean useLegacyScaling) {
|
||||
if (useLegacyScaling) {
|
||||
double speed = 1.0 * thisTiming / etalonTiming;
|
||||
double delta = speed < 1
|
||||
? 0.9 + Math.pow(speed - 0.7, 2)
|
||||
: 0.45 + Math.pow(speed - 0.25, 2);
|
||||
expectedOnMyMachine *= delta;
|
||||
return expectedOnMyMachine;
|
||||
}
|
||||
else {
|
||||
return (int)(expectedOnMyMachine * thisTiming / etalonTiming);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -122,7 +122,7 @@ public class AntHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
public void run() {
|
||||
doDoTest(true, false);
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
finally {
|
||||
myIgnoreInfos = false;
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -116,7 +116,7 @@ class GroovyStressPerformanceTest extends LightGroovyTestCase {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
}
|
||||
|
||||
} as ThrowableRunnable).assertTiming()
|
||||
} as ThrowableRunnable).useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
public void testManyAnnotatedFields() {
|
||||
@@ -130,7 +130,7 @@ class GroovyStressPerformanceTest extends LightGroovyTestCase {
|
||||
}
|
||||
|
||||
private void measureHighlighting(String text, int time) {
|
||||
IdeaTestUtil.startPerformanceTest("slow", time, configureAndHighlight(text)).cpuBound().usesAllCPUCores().assertTiming()
|
||||
IdeaTestUtil.startPerformanceTest("slow", time, configureAndHighlight(text)).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
public void testDeeplyNestedClosures() {
|
||||
@@ -264,7 +264,7 @@ while (true) {
|
||||
f.canoPath<caret>
|
||||
}
|
||||
'''
|
||||
IdeaTestUtil.startPerformanceTest("slow", 300, configureAndComplete(text)).cpuBound().usesAllCPUCores().assertTiming()
|
||||
IdeaTestUtil.startPerformanceTest("slow", 300, configureAndComplete(text)).cpuBound().usesAllCPUCores().useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
public void testClosureRecursion() {
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ class IdeaDecompilerTest : LightCodeInsightFixtureTestCase() {
|
||||
fun testPerformance() {
|
||||
val decompiler = IdeaDecompiler()
|
||||
val file = getTestFile("${PlatformTestUtil.getRtJarPath()}!/javax/swing/JTable.class")
|
||||
PlatformTestUtil.startPerformanceTest("decompiling JTable.class", 4000, { decompiler.getText(file) }).cpuBound().assertTiming()
|
||||
PlatformTestUtil.startPerformanceTest("decompiling JTable.class", 4000, { decompiler.getText(file) }).cpuBound().useLegacyScaling().assertTiming()
|
||||
}
|
||||
|
||||
fun testCancellation() {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PropertiesEnterTest extends LightPlatformCodeInsightTestCase {
|
||||
type("aaaa=bbb");
|
||||
PsiDocumentManager.getInstance(ourProject).commitAllDocuments();
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class DictionaryTest {
|
||||
public void run() {
|
||||
ref.set(CompressedDictionary.create(getLoader(name), myTransformation));
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
|
||||
assertFalse(ref.isNull());
|
||||
return ref.get();
|
||||
@@ -98,7 +98,7 @@ public class DictionaryTest {
|
||||
assertEquals(Boolean.TRUE, dictionary.contains(s));
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
private void containsWordTest(Dictionary dictionary) {
|
||||
|
||||
+1
-1
@@ -54,6 +54,6 @@ public class SpellcheckerPerformanceTest extends SpellcheckerInspectionTestCase
|
||||
public void run() {
|
||||
assertSize(typoCount, myFixture.doHighlighting());
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase{
|
||||
element.addChildElement().copyFrom(child);
|
||||
}
|
||||
}
|
||||
}).cpuBound().attempts(1).assertTiming();
|
||||
}).cpuBound().attempts(1).useLegacyScaling().assertTiming();
|
||||
|
||||
final MyElement newElement = createElement(DomUtil.getFile(element).getText(), MyElement.class);
|
||||
|
||||
@@ -75,7 +75,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase{
|
||||
});
|
||||
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testShouldntParseNonDomFiles() throws Throwable {
|
||||
@@ -125,7 +125,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase{
|
||||
public void run() throws Exception {
|
||||
assertNull(getDomManager().getFileElement(file));
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
|
||||
public void testDontParseNamespacedDomFiles() throws Exception {
|
||||
|
||||
@@ -271,7 +271,7 @@ public class XmlParsingTest extends ParsingTestCase {
|
||||
System.out.println("Reparsed for: " + (System.currentTimeMillis() - tm));
|
||||
}
|
||||
}
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
}
|
||||
}.execute();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -78,7 +78,7 @@ public class XmlPerformanceTest extends LightQuickFixTestCase {
|
||||
EditorActionManager.getInstance().getActionHandler("EditorIndentSelection").execute(myEditor, DataManager.getInstance().getDataContext());
|
||||
|
||||
EditorActionManager.getInstance().getActionHandler("EditorUnindentSelection").execute(myEditor, DataManager.getInstance().getDataContext());
|
||||
}).cpuBound().assertTiming();
|
||||
}).cpuBound().useLegacyScaling().assertTiming();
|
||||
final int startOffset = myEditor.getCaretModel().getOffset();
|
||||
myEditor.getSelectionModel().setSelection(startOffset,startOffset);
|
||||
checkResultByFile(getBasePath() + getTestName(false)+".xml");
|
||||
|
||||
Reference in New Issue
Block a user