mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 06:36:56 +07:00
[benchmarks] Renaming PerformanceTest* => Benchmark*
GitOrigin-RevId: 9963b84d51e1062acc262a8d3d3de1409a708e3b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f4c5a365ab
commit
cdf91bf213
@@ -6,7 +6,7 @@ import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class JavaCommentByLineTest extends CommentByLineTestBase {
|
||||
@@ -131,7 +131,7 @@ public class JavaCommentByLineTest extends CommentByLineTestBase {
|
||||
source.append("}");
|
||||
configureFromFileText(getTestName(false) + ".java", source.toString());
|
||||
executeAction(IdeActions.ACTION_SELECT_ALL);
|
||||
PerformanceTestUtil.newPerformanceTest("Uncommenting large file", CommentByLineTestBase::performAction)
|
||||
Benchmark.newBenchmark("Uncommenting large file", CommentByLineTestBase::performAction)
|
||||
.setup(CommentByLineTestBase::performAction)
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.ExtensionTestUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.Timings;
|
||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -58,7 +58,7 @@ public class DaemonRespondToChangesPerformanceTest extends DaemonAnalyzerTestCas
|
||||
text.append(".toString();<caret>}");
|
||||
configureByText(JavaFileType.INSTANCE, text.toString());
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
List<HighlightInfo> infos = highlightErrors();
|
||||
assertEmpty(infos);
|
||||
type("k");
|
||||
@@ -79,7 +79,7 @@ public class DaemonRespondToChangesPerformanceTest extends DaemonAnalyzerTestCas
|
||||
PlatformTestUtil.maskExtensions(MultiHostInjector.MULTIHOST_INJECTOR_EP_NAME, getProject(), Collections.emptyList(), getTestRootDisposable());
|
||||
ExtensionTestUtil.maskExtensions(LanguageInjector.EXTENSION_POINT_NAME, Collections.emptyList(), getTestRootDisposable());
|
||||
ExtensionTestUtil.maskExtensions(new ExtensionPointName<>(LanguageAnnotators.INSTANCE.getName()), Collections.emptyList(), getTestRootDisposable());
|
||||
PerformanceTestUtil.newPerformanceTest("highlighting many string literals", () -> {
|
||||
Benchmark.newBenchmark("highlighting many string literals", () -> {
|
||||
assertEmpty(highlightErrors());
|
||||
|
||||
type("k");
|
||||
@@ -101,7 +101,7 @@ public class DaemonRespondToChangesPerformanceTest extends DaemonAnalyzerTestCas
|
||||
".toString(); } }";
|
||||
configureByText(JavaFileType.INSTANCE, text);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("highlighting deep call chain", () -> {
|
||||
Benchmark.newBenchmark("highlighting deep call chain", () -> {
|
||||
assertEmpty(highlightErrors());
|
||||
|
||||
type("k");
|
||||
|
||||
@@ -3,14 +3,14 @@ package com.intellij.codeInsight.daemon.impl.quickfix;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
|
||||
@SkipSlowTestLocally
|
||||
public class CreateMethodFromUsagePerformanceTest extends LightQuickFixTestCase {
|
||||
|
||||
public void testWithHugeNumberOfParameters() {
|
||||
PerformanceTestUtil.newPerformanceTest("5000 args for a new method", () -> {
|
||||
Benchmark.newBenchmark("5000 args for a new method", () -> {
|
||||
String text = "class Foo {{ f<caret>oo(" + StringUtil.repeat("\"a\", ", 5000) + " \"a\");}}";
|
||||
configureFromFileText("Foo.java", text);
|
||||
doAction("Create method 'foo' in 'Foo'");
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.java.codeInsight;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.testFramework.LightJavaCodeInsightTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -26,7 +26,7 @@ public class JoinLinesPerformanceTest extends LightJavaCodeInsightTestCase {
|
||||
}""";
|
||||
String inputText = text.replace("$bytes$", bytesOriginal);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> executeAction(IdeActions.ACTION_EDITOR_JOIN_LINES))
|
||||
Benchmark.newBenchmark(getTestName(false), () -> executeAction(IdeActions.ACTION_EDITOR_JOIN_LINES))
|
||||
.setup(() -> configureFromFileText("X.java", inputText))
|
||||
.start();
|
||||
String outputText = text.replace("$bytes$", bytesResult);
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.NeedsIndex;
|
||||
import com.intellij.testFramework.ServiceContainerUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.siyeh.ig.style.UnqualifiedFieldAccessInspection;
|
||||
@@ -2325,7 +2325,7 @@ public class NormalCompletionTest extends NormalCompletionTestCase {
|
||||
"localV<caret>x }" +
|
||||
"}";
|
||||
myFixture.configureByText("a.java", text);
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
assertEquals(1, myFixture.completeBasic().length);
|
||||
}).setup(() -> {
|
||||
LookupImpl lookup = getLookup();
|
||||
@@ -2345,7 +2345,7 @@ public class NormalCompletionTest extends NormalCompletionTestCase {
|
||||
"}";
|
||||
myFixture.addClass(constantClass);
|
||||
myFixture.configureByText("a.java", "import static Constants.*; class C { { field<caret>x } }");
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
int length = myFixture.completeBasic().length;
|
||||
assertTrue(String.valueOf(length), length > 100);
|
||||
}).setup(() -> {
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.codeInsight.completion.LightFixtureCompletionTestCase;
|
||||
import com.intellij.codeInsight.lookup.LookupElementPresentation;
|
||||
import com.intellij.codeInsight.lookup.LookupManager;
|
||||
import com.intellij.testFramework.NeedsIndex;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCas
|
||||
|
||||
public void testChainingPerformance() throws Throwable {
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() {
|
||||
Benchmark.newBenchmark(getTestName(false), new ThrowableRunnable() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
configure();
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.intellij.psi.impl.source.tree.injected.ConcatenationInjectorManager;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -70,7 +70,7 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest
|
||||
assertNotNull(getFile().getText()); //to load text
|
||||
CodeInsightTestFixtureImpl.ensureIndexesUpToDate(getProject());
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), this::doHighlighting)
|
||||
Benchmark.newBenchmark(getTestName(false), this::doHighlighting)
|
||||
.setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches())
|
||||
.start();
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public class LightAdvHighlightingPerformanceTest extends LightDaemonAnalyzerTest
|
||||
assertNotNull(message, ProjectCoreUtil.theOnlyOpenProject());
|
||||
getFile().accept(new PsiRecursiveElementVisitor() {});
|
||||
Project myProject = getProject();
|
||||
PerformanceTestUtil.newPerformanceTest("getProject() for nested elements", () -> {
|
||||
Benchmark.newBenchmark("getProject() for nested elements", () -> {
|
||||
for (int k=0; k<5; k++) {
|
||||
getFile().accept(new PsiRecursiveElementVisitor() {
|
||||
int c;
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.java.codeInsight.daemon;
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -19,7 +19,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase {
|
||||
final PsiElement expression =
|
||||
JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text, null);
|
||||
final int[] n = {0};
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() {
|
||||
Benchmark.newBenchmark(getTestName(false), new ThrowableRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
n[0] = 0;
|
||||
@@ -42,7 +42,7 @@ public class RecursiveVisitorTest extends LightDaemonAnalyzerTestCase {
|
||||
final PsiElement expression =
|
||||
JavaPsiFacade.getElementFactory(getProject()).createStatementFromText(text, null);
|
||||
final int[] n = {0};
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), new ThrowableRunnable() {
|
||||
Benchmark.newBenchmark(getTestName(false), new ThrowableRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
n[0] = 0;
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.java.codeInsight.daemon.indentGuide;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -24,7 +24,7 @@ public class JavaTextBlockIndentGuidePerformanceTest extends LightDaemonAnalyzer
|
||||
String text = "class X {\n" +
|
||||
createCodeBlocks(n, nLines) +
|
||||
"\n}";
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), this::doHighlighting)
|
||||
Benchmark.newBenchmark(getTestName(false), this::doHighlighting)
|
||||
.setup(() -> configureFromFileText("X.java", text))
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.PsiMethodCallExpression;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import one.util.streamex.IntStreamEx;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -32,19 +32,19 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase {
|
||||
@NonNls static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/lambda/performance";
|
||||
|
||||
public void testPolyMethodCallArgumentPassedToVarargs() {
|
||||
PerformanceTestUtil.newPerformanceTest("50 poly method calls passed to Arrays.asList", this::doTest).start();
|
||||
Benchmark.newBenchmark("50 poly method calls passed to Arrays.asList", this::doTest).start();
|
||||
}
|
||||
|
||||
public void testDiamondConstructorCallPassedToVarargs() {
|
||||
PerformanceTestUtil.newPerformanceTest("50 diamond constructor calls passed to Arrays.asList", this::doTest).start();
|
||||
Benchmark.newBenchmark("50 diamond constructor calls passed to Arrays.asList", this::doTest).start();
|
||||
}
|
||||
|
||||
public void testDiamondConstructorCallPassedToEnumConstantWithVarargs() {
|
||||
PerformanceTestUtil.newPerformanceTest("10 enum constants with vararg diamonds", this::doTest).start();
|
||||
Benchmark.newBenchmark("10 enum constants with vararg diamonds", this::doTest).start();
|
||||
}
|
||||
|
||||
public void testLeastUpperBoundWithLotsOfSupers() {
|
||||
PerformanceTestUtil.newPerformanceTest("7 unrelated intersection conjuncts", this::doTest).start();
|
||||
Benchmark.newBenchmark("7 unrelated intersection conjuncts", this::doTest).start();
|
||||
}
|
||||
|
||||
public void testVarArgPoly() {
|
||||
@@ -66,18 +66,18 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase {
|
||||
int count = 70;
|
||||
String entries = IntStreamEx.range(count).mapToObj(i -> "entry(" + i + ", String.class)").joining(",\n ");
|
||||
configureFromFileText("Test.java", template.replace("$entries$", entries));
|
||||
PerformanceTestUtil.newPerformanceTest(count + " arguments to Map.ofEntries", () -> doHighlighting())
|
||||
Benchmark.newBenchmark(count + " arguments to Map.ofEntries", () -> doHighlighting())
|
||||
.setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches())
|
||||
.start();
|
||||
assertEmpty(highlightErrors());
|
||||
}
|
||||
|
||||
public void testLongQualifierChainInsideLambda() {
|
||||
PerformanceTestUtil.newPerformanceTest("long qualifier chain", this::doTest).start();
|
||||
Benchmark.newBenchmark("long qualifier chain", this::doTest).start();
|
||||
}
|
||||
|
||||
public void testLongQualifierChainInsideLambdaWithOverloads() {
|
||||
PerformanceTestUtil.newPerformanceTest("long qualifier chain", () -> {
|
||||
Benchmark.newBenchmark("long qualifier chain", () -> {
|
||||
configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
|
||||
PsiMethodCallExpression callExpression =
|
||||
PsiTreeUtil.getParentOfType(getFile().findElementAt(getEditor().getCaretModel().getOffset()), PsiMethodCallExpression.class);
|
||||
@@ -117,7 +117,7 @@ public class InferencePerformanceTest extends LightDaemonAnalyzerTestCase {
|
||||
String entries = "foo(snippet.valueOf(foo))\n" +//to trick injection
|
||||
StringUtil.repeat(".foo(snippet.valueOf(foo))\n", count);
|
||||
configureFromFileText("Test.java", template.replace("$chain$", entries));
|
||||
PerformanceTestUtil.newPerformanceTest(count + " chain in type cast", () -> doHighlighting())
|
||||
Benchmark.newBenchmark(count + " chain in type cast", () -> doHighlighting())
|
||||
.setup(() -> PsiManager.getInstance(getProject()).dropPsiCaches())
|
||||
.start();
|
||||
assertEmpty(highlightErrors());
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiFormatUtilBase;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
@@ -86,11 +86,11 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase {
|
||||
}
|
||||
|
||||
public void testManyOverloadsWithVarargs() {
|
||||
PerformanceTestUtil.newPerformanceTest("Overload resolution with 14 overloads", () -> doTest(false)).start();
|
||||
Benchmark.newBenchmark("Overload resolution with 14 overloads", () -> doTest(false)).start();
|
||||
}
|
||||
|
||||
public void testConstructorOverloadsWithDiamonds() {
|
||||
PerformanceTestUtil.newPerformanceTest("Overload resolution with chain constructor calls with diamonds", () -> doTest(false)).start();
|
||||
Benchmark.newBenchmark("Overload resolution with chain constructor calls with diamonds", () -> doTest(false)).start();
|
||||
}
|
||||
|
||||
public void testMultipleOverloadsWithNestedGeneric() {
|
||||
|
||||
@@ -7,12 +7,12 @@ import com.intellij.psi.controlFlow.ControlFlow;
|
||||
import com.intellij.psi.controlFlow.ControlFlowFactory;
|
||||
import com.intellij.psi.controlFlow.LocalsControlFlowPolicy;
|
||||
import com.intellij.testFramework.LightJavaCodeInsightTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import one.util.streamex.StreamEx;
|
||||
|
||||
public class ControlFlowPerformanceTest extends LightJavaCodeInsightTestCase {
|
||||
public void testHugeMethodChainControlFlow() {
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
int size = 2500;
|
||||
String source = StreamEx.constant(".toString()", size).joining("", "\"\"", "");
|
||||
PsiExpression expression = JavaPsiFacade.getElementFactory(getProject()).createExpressionFromText(source, null);
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.DocumentUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -43,7 +43,7 @@ public class ConsoleViewExceptionFilterPerformanceTest extends LightJavaCodeInsi
|
||||
}
|
||||
}
|
||||
}""");
|
||||
PerformanceTestUtil.newPerformanceTest("Many exceptions", () -> {
|
||||
Benchmark.newBenchmark("Many exceptions", () -> {
|
||||
// instantiate console with exception filters only to avoid failures due to Node/Ruby/etc dog-slow sloppy regex-based filters
|
||||
TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(getProject());
|
||||
consoleBuilder.filters(ExceptionFilters.getFilters(GlobalSearchScope.allScope(getProject())));
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.intellij.openapi.util.registry.RegistryValue;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.EditorMouseFixture;
|
||||
import com.intellij.ui.HintHint;
|
||||
import com.intellij.ui.LightweightHint;
|
||||
@@ -328,7 +328,7 @@ public class FindInEditorTest extends LightPlatformCodeInsightTestCase {
|
||||
myFindModel.setReplaceState(true);
|
||||
myFindModel.setPromptOnReplace(false);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("replace", ()->{
|
||||
Benchmark.newBenchmark("replace", ()->{
|
||||
for (int i=0; i<25; i++) {
|
||||
myFindModel. setStringToFind(aas);
|
||||
myFindModel.setStringToReplace(bbs);
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.IndexingTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestUtil;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -95,7 +95,7 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas
|
||||
final PsiFile file = myFixture.addFileToProject("Foo.java", fileText);
|
||||
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
PsiElement[] impls = getTargets(file);
|
||||
assertEquals(3, impls.length);
|
||||
}).start();
|
||||
@@ -126,7 +126,7 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas
|
||||
final PsiFile file = myFixture.addFileToProject("Foo.java", fileText);
|
||||
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
PsiElement[] impls = getTargets(file);
|
||||
assertEquals(3, impls.length);
|
||||
}).start();
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.intellij.psi.text.BlockSupport;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.xml.XmlText;
|
||||
import com.intellij.testFramework.LightVirtualFile;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
@@ -293,7 +293,7 @@ public class JavaReparseTest extends AbstractReparseTestCase {
|
||||
Document document = pdm.getDocument(file);
|
||||
|
||||
WriteCommandAction.runWriteCommandAction(getProject(), () -> {
|
||||
PerformanceTestUtil.newPerformanceTest("deep reparse", () -> {
|
||||
Benchmark.newBenchmark("deep reparse", () -> {
|
||||
document.insertString(document.getTextLength() - suffix.length(), call1);
|
||||
pdm.commitDocument(document);
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.intellij.psi.stubs.StubElement;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.testFramework.LightIdeaTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.intellij.lang.annotations.Language;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -831,7 +831,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();
|
||||
PerformanceTestUtil.newPerformanceTest(message, () -> myBuilder.buildStubTree(file)).start();
|
||||
Benchmark.newBenchmark(message, () -> myBuilder.buildStubTree(file)).start();
|
||||
}
|
||||
|
||||
private void doTest(/*@Language("JAVA")*/ String source, @Language("TEXT") String expected) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.JavaTestUtil;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.autodetect.AbstractIndentAutoDetectionTest;
|
||||
import com.intellij.testFramework.TeamCityLogger;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
@@ -62,8 +62,8 @@ public class JavaAutoDetectIndentPerformanceTest extends AbstractIndentAutoDetec
|
||||
configureByFile(getFileNameWithExtension());
|
||||
detectIndentOptions(getVFile(), getEditor().getDocument());
|
||||
|
||||
PerformanceTestUtil
|
||||
.newPerformanceTest("Detecting indent on hot file", () -> detectIndentOptions(getVFile(), getEditor().getDocument()))
|
||||
Benchmark
|
||||
.newBenchmark("Detecting indent on hot file", () -> detectIndentOptions(getVFile(), getEditor().getDocument()))
|
||||
.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleSettings;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
|
||||
public class JavaEnterActionTest extends AbstractBasicJavaEnterActionTest {
|
||||
@@ -1131,7 +1131,7 @@ public class JavaEnterActionTest extends AbstractBasicJavaEnterActionTest {
|
||||
|
||||
public void testPerformance() {
|
||||
configureByFile("/codeInsight/enterAction/Performance.java");
|
||||
PerformanceTestUtil.newPerformanceTest("enter in " + getFile(), () -> {
|
||||
Benchmark.newBenchmark("enter in " + getFile(), () -> {
|
||||
performAction();
|
||||
deleteLine();
|
||||
caretUp();
|
||||
@@ -1145,6 +1145,6 @@ public class JavaEnterActionTest extends AbstractBasicJavaEnterActionTest {
|
||||
" u." +
|
||||
StringUtil.repeat("\n a('b').c(new Some()).", 500)) + "<caret>\n" +
|
||||
" x(); } }");
|
||||
PerformanceTestUtil.newPerformanceTest("enter", this::performAction).start();
|
||||
Benchmark.newBenchmark("enter", this::performAction).start();
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@@ -45,7 +45,7 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase {
|
||||
FormatterImpl formatter = (FormatterImpl)FormatterEx.getInstanceEx();
|
||||
CommonCodeStyleSettings.IndentOptions options = settings.getIndentOptions(JavaFileType.INSTANCE);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Java Formatting [1]", () -> {
|
||||
Benchmark.newBenchmark("Java Formatting [1]", () -> {
|
||||
FormattingModel model =
|
||||
LanguageFormatting.INSTANCE.forContext(file).createModel(FormattingContext.create(file, settings));
|
||||
formatter.formatWithoutModifications(model.getDocumentModel(), model.getRootBlock(), settings, options, file.getTextRange());
|
||||
@@ -58,7 +58,7 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase {
|
||||
|
||||
public void testPerformance2() {
|
||||
getSettings().setDefaultRightMargin(120);
|
||||
PerformanceTestUtil.newPerformanceTest("Java Formatting [2]", () -> doTest())
|
||||
Benchmark.newBenchmark("Java Formatting [2]", () -> doTest())
|
||||
.warmupIterations(5)
|
||||
.attempts(20)
|
||||
.start();
|
||||
@@ -76,7 +76,7 @@ public class JavaFormatterPerformanceTest extends JavaFormatterTestCase {
|
||||
indentOptions.USE_TAB_CHARACTER = true;
|
||||
indentOptions.TAB_SIZE = 4;
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Java Formatting [3]", () -> doTest())
|
||||
Benchmark.newBenchmark("Java Formatting [3]", () -> doTest())
|
||||
.warmupIterations(100)
|
||||
.attempts(300)
|
||||
.start();
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
|
||||
public class JavaSmartReformatPerformanceTest extends AbstractJavaFormatterTest {
|
||||
@@ -37,8 +37,8 @@ public class JavaSmartReformatPerformanceTest extends AbstractJavaFormatterTest
|
||||
commandProcessor.executeCommand(project, command, null, null);
|
||||
};
|
||||
|
||||
PerformanceTestUtil
|
||||
.newPerformanceTest("smart reformat on big file", test)
|
||||
Benchmark
|
||||
.newBenchmark("smart reformat on big file", test)
|
||||
.setup(setup)
|
||||
.warmupIterations(50)
|
||||
.attempts(100)
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.intellij.psi.impl.source.resolve.ResolveCache;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.testFramework.JavaResolveTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import one.util.streamex.IntStreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -106,7 +106,7 @@ public class ResolvePerformanceTest extends JavaResolveTestCase {
|
||||
|
||||
PsiReference ref = configureByFile("class/" + getTestName(false) + ".java");
|
||||
ensureIndexUpToDate();
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> assertNull(ref.resolve()))
|
||||
Benchmark.newBenchmark(getTestName(false), () -> assertNull(ref.resolve()))
|
||||
.warmupIterations(20)
|
||||
.attempts(50)
|
||||
.start();
|
||||
@@ -131,7 +131,7 @@ public class ResolvePerformanceTest extends JavaResolveTestCase {
|
||||
|
||||
List<PsiJavaCodeReferenceElement> refs = SyntaxTraverser.psiTraverser(file).filter(PsiJavaCodeReferenceElement.class).toList();
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (PsiJavaCodeReferenceElement ref : refs) {
|
||||
assertNotNull(ref.resolve());
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class ResolvePerformanceTest extends JavaResolveTestCase {
|
||||
}
|
||||
|
||||
ensureIndexUpToDate();
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> assertNull(ref.resolve()))
|
||||
Benchmark.newBenchmark(getTestName(false), () -> assertNull(ref.resolve()))
|
||||
.warmupIterations(20)
|
||||
.attempts(50)
|
||||
.start();
|
||||
@@ -181,7 +181,7 @@ public class ResolvePerformanceTest extends JavaResolveTestCase {
|
||||
}
|
||||
|
||||
public void testLongIdentifierDotChain() {
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
PsiFile file = createDummyFile("a.java", "class C { { " + StringUtil.repeat("obj.", 100) + "foo } }");
|
||||
PsiReference ref = file.findReferenceAt(file.getText().indexOf("foo"));
|
||||
assertNull(ref.resolve());
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.intellij.psi.util.PsiUtilBase;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.FileContentUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ref.GCUtil;
|
||||
@@ -683,7 +683,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase {
|
||||
final Document document = file.getViewProvider().getDocument();
|
||||
assertNotNull(document);
|
||||
|
||||
WriteAction.run(() -> PerformanceTestUtil.newPerformanceTest("smart pointer range update", () -> {
|
||||
WriteAction.run(() -> Benchmark.newBenchmark("smart pointer range update", () -> {
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
document.insertString(i * 20 + 100, "x\n");
|
||||
assertFalse(PsiDocumentManager.getInstance(myProject).isCommitted(document));
|
||||
@@ -883,7 +883,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase {
|
||||
XmlFile file = (XmlFile)createFile("a.xml", "<root>\n" + StringUtil.repeat(eachTag, 500) + "</root>");
|
||||
List<XmlTag> tags = new ArrayList<>(PsiTreeUtil.findChildrenOfType(file.getDocument(), XmlTag.class));
|
||||
List<SmartPsiElementPointer> pointers = ContainerUtil.map(tags, this::createPointer);
|
||||
ApplicationManager.getApplication().runWriteAction(() -> PerformanceTestUtil.newPerformanceTest("smart pointer range update after PSI change", () -> {
|
||||
ApplicationManager.getApplication().runWriteAction(() -> Benchmark.newBenchmark("smart pointer range update after PSI change", () -> {
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
XmlTag tag = tags.get(i);
|
||||
SmartPsiElementPointer pointer = pointers.get(i);
|
||||
@@ -950,7 +950,7 @@ public class SmartPsiElementPointersTest extends JavaCodeInsightTestCase {
|
||||
String text = StringUtil.repeatSymbol(' ', 100000);
|
||||
PsiFile file = createFile("a.txt", text);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
List<SmartPsiFileRange> pointers = new ArrayList<>();
|
||||
for (int i = 0; i < text.length() - 1; i++) {
|
||||
pointers.add(getPointerManager().createSmartPsiFileRangePointer(file, new TextRange(i, i + 1)));
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileCreateEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
|
||||
import com.intellij.testFramework.JavaModuleTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.VfsTestUtil;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -407,7 +407,7 @@ public class RootsChangedTest extends JavaModuleTestCase {
|
||||
|
||||
VirtualFile xxx = createChildDirectory(temp, dirName);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("time wasted in ProjectRootManagerComponent.before/afterValidityChanged()", ()->{
|
||||
Benchmark.newBenchmark("time wasted in ProjectRootManagerComponent.before/afterValidityChanged()", ()->{
|
||||
for (int i = 0; i < 100; i++) {
|
||||
rename(xxx, "yyy");
|
||||
rename(xxx, dirName);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.unscramble;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
@@ -389,12 +389,12 @@ public class ThreadDumpParserTest extends TestCase {
|
||||
public void testVeryLongLineParsingPerformance() {
|
||||
final String spaces = " ".repeat(1_000_000);
|
||||
final String letters = "a".repeat(1_000_000);
|
||||
PerformanceTestUtil.newPerformanceTest("parsing spaces", () -> {
|
||||
Benchmark.newBenchmark("parsing spaces", () -> {
|
||||
List<ThreadState> threads = ThreadDumpParser.parse(spaces);
|
||||
assertTrue(threads.isEmpty());
|
||||
}).startAsSubtest();
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("parsing letters", () -> {
|
||||
Benchmark.newBenchmark("parsing letters", () -> {
|
||||
List<ThreadState> threads = ThreadDumpParser.parse(letters);
|
||||
assertTrue(threads.isEmpty());
|
||||
}).startAsSubtest();
|
||||
|
||||
@@ -67,7 +67,7 @@ import com.intellij.psi.util.PsiModificationTracker;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.indexing.dependencies.IndexingRequestToken;
|
||||
import com.intellij.util.indexing.dependencies.IsFileChangedResult;
|
||||
@@ -957,7 +957,7 @@ public class IndexTest extends JavaCodeInsightFixtureTestCase {
|
||||
final String filename = "A.java";
|
||||
myFixture.addFileToProject("foo/bar/" + filename, "class A {}");
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Vfs Event Processing By Index", () -> {
|
||||
Benchmark.newBenchmark("Vfs Event Processing By Index", () -> {
|
||||
PsiFile[] files = FilenameIndex.getFilesByName(getProject(), filename, GlobalSearchScope.moduleScope(getModule()));
|
||||
assertEquals(1, files.length);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.intellij.json.formatter.JsonCodeStyleSettings.PropertyAlignment;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ public class JsonFormattingTest extends JsonTestCase {
|
||||
public void testHugeJsonFile() {
|
||||
// IDEA-195340 bad JSON kills IntelliJ
|
||||
myFixture.configureByFile(getTestName(false) + ".json");
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), this::reformatAndCheck).attempts(1).start();
|
||||
Benchmark.newBenchmark(getTestName(false), this::reformatAndCheck).attempts(1).start();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.jetbrains.jsonSchema.impl.JsonSchemaVersion;
|
||||
import com.jetbrains.jsonSchema.impl.inspections.JsonSchemaComplianceInspection;
|
||||
@@ -46,7 +46,7 @@ public class JsonSchemaPerformanceTest extends JsonSchemaHeavyAbstractTest {
|
||||
private void doTestAzurePerformance(boolean useNewImplementation) throws IOException {
|
||||
Registry.get("json.schema.object.v2").setValue(useNewImplementation);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Highlight azure json by schema", () -> {
|
||||
Benchmark.newBenchmark("Highlight azure json by schema", () -> {
|
||||
myFixture.enableInspections(JsonSchemaComplianceInspection.class);
|
||||
myFixture.enableInspections(JsonSchemaRefReferenceInspection.class);
|
||||
myFixture.enableInspections(JsonSchemaDeprecationInspection.class);
|
||||
@@ -89,11 +89,11 @@ public class JsonSchemaPerformanceTest extends JsonSchemaHeavyAbstractTest {
|
||||
myFixture.doHighlighting();
|
||||
}
|
||||
});
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), test).attempts(5).start();
|
||||
Benchmark.newBenchmark(getTestName(false), test).attempts(5).start();
|
||||
}
|
||||
|
||||
public void testEslintHighlightingPerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(true), () -> {
|
||||
Benchmark.newBenchmark(getTestName(true), () -> {
|
||||
PsiFile psiFile = myFixture.configureByFile(getTestName(true) + "/.eslintrc.json");
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.jetbrains.jsonSchema.remote;
|
||||
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import com.jetbrains.jsonSchema.JsonSchemaHeavyAbstractTest;
|
||||
import com.jetbrains.jsonSchema.ide.JsonSchemaService;
|
||||
@@ -55,7 +55,7 @@ public class JsonSchemaCatalogManagerTest extends BasePlatformTestCase {
|
||||
VirtualFile file = myFixture.addFileToProject("some/unknown.json", "").getVirtualFile();
|
||||
VirtualFile schemaFile = myCatalogManager.getSchemaFileForFile(file);
|
||||
Assert.assertNull(schemaFile);
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
VirtualFile result = myCatalogManager.getSchemaFileForFile(file);
|
||||
Assert.assertNull(result);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package com.intellij.diff.util
|
||||
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.util.containers.Interner
|
||||
import com.intellij.util.diff.Diff
|
||||
import com.intellij.util.diff.FilesTooBigForDiffException
|
||||
@@ -221,7 +221,7 @@ class DiffPerformanceTest : TestCase() {
|
||||
|
||||
|
||||
private inline fun testCpu(iterations: Int, crossinline test: () -> Unit) {
|
||||
PerformanceTestUtil.newPerformanceTest(PlatformTestUtil.getTestName(name, true)) {
|
||||
Benchmark.newBenchmark(PlatformTestUtil.getTestName(name, true)) {
|
||||
for (i in 0..iterations) {
|
||||
test()
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.find;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
|
||||
public class FindInEditorPerformanceTest extends AbstractFindInEditorTest {
|
||||
public void testEditingWithSearchResultsShown() {
|
||||
@@ -11,7 +11,7 @@ public class FindInEditorPerformanceTest extends AbstractFindInEditorTest {
|
||||
setTextToFind("s");
|
||||
assertEquals(9999 + 1 /* cursor highlighting */, getEditor().getMarkupModel().getAllHighlighters().length);
|
||||
getEditor().getCaretModel().moveToOffset(0);
|
||||
PerformanceTestUtil.newPerformanceTest("typing in editor when a lot of search results are highlighted", () -> {
|
||||
Benchmark.newBenchmark("typing in editor when a lot of search results are highlighted", () -> {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
myFixture.type(' ');
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.io.storage.AbstractStorage;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
@@ -41,7 +41,7 @@ public class LocalHistoryStorageTest extends IntegrationTestCase {
|
||||
() -> VirtualFileManager.getInstance().findFileByUrl("temp:///").createChildData(null, "testChangesAccumulationPerformance.txt")
|
||||
);
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("local history changes accumulation", () -> {
|
||||
Benchmark.newBenchmark("local history changes accumulation", () -> {
|
||||
doChangesAccumulationPerformanceTest(f);
|
||||
}).start();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.fileTypes.PlainTextFileType;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -302,7 +302,7 @@ public class PlainTextEditingTest extends EditingTestBase {
|
||||
public void testCalculatingLongLinesPositionPerformanceInEditorWithNoTabs() {
|
||||
final String longLine = StringUtil.repeatSymbol(' ', 1000000);
|
||||
configureFromFileText("x.txt", longLine);
|
||||
PerformanceTestUtil.newPerformanceTest("calcOffset", () -> {
|
||||
Benchmark.newBenchmark("calcOffset", () -> {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
int off = getEditor().logicalPositionToOffset(new LogicalPosition(0, longLine.length() - 1));
|
||||
assertEquals(longLine.length() - 1, off);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.execution.filters;
|
||||
|
||||
import com.intellij.ide.browsers.OpenUrlHyperlinkInfo;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class UrlFilterTest extends BasePlatformTestCase {
|
||||
public void testPerformanceSimple() {
|
||||
List<LinkInfo> expected = List.of(new FileLinkInfo(7, 30, "/home/file.txt", 3, -1),
|
||||
new FileLinkInfo(34, 62, "/home/result.txt", 3, 30));
|
||||
PerformanceTestUtil.newPerformanceTest("Find file hyperlinks", () -> {
|
||||
Benchmark.newBenchmark("Find file hyperlinks", () -> {
|
||||
for (int i = 0; i < 100_000; i++) {
|
||||
Filter.Result result = applyFilter("before file:///home/file.txt:3 -> file:///home/result.txt:3:30 after");
|
||||
assertHyperlinks(result, expected);
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.LineSeparator;
|
||||
@@ -268,7 +268,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
|
||||
public void testPerformance() {
|
||||
withCycleConsoleNoFolding(100, console ->
|
||||
PerformanceTestUtil.newPerformanceTest("console print", () -> {
|
||||
Benchmark.newBenchmark("console print", () -> {
|
||||
console.clear();
|
||||
for (int i=0; i<10_000_000; i++) {
|
||||
console.print("xxx\n", ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
@@ -282,7 +282,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
|
||||
public void testLargeConsolePerformance() {
|
||||
withCycleConsoleNoFolding(UISettings.getInstance().getConsoleCycleBufferSizeKb(), console ->
|
||||
PerformanceTestUtil.newPerformanceTest("console print", () -> {
|
||||
Benchmark.newBenchmark("console print", () -> {
|
||||
console.clear();
|
||||
for (int i=0; i<20_000_000; i++) {
|
||||
console.print("hello\n", ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
@@ -294,7 +294,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
|
||||
public void testPerformanceOfMergeableTokens() {
|
||||
withCycleConsoleNoFolding(1000, console ->
|
||||
PerformanceTestUtil.newPerformanceTest("console print with mergeable tokens", () -> {
|
||||
Benchmark.newBenchmark("console print with mergeable tokens", () -> {
|
||||
console.clear();
|
||||
for (int i=0; i<10_000_000; i++) {
|
||||
console.print("xxx\n", ConsoleViewContentType.NORMAL_OUTPUT);
|
||||
@@ -693,7 +693,7 @@ public class ConsoleViewImplTest extends LightPlatformTestCase {
|
||||
public void testBackspacePerformance() {
|
||||
int nCopies = 10000;
|
||||
String in = StringUtil.repeat("\na\nb\bc", nCopies);
|
||||
PerformanceTestUtil.newPerformanceTest("print newlines with backspace", () -> {
|
||||
Benchmark.newBenchmark("print newlines with backspace", () -> {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
myConsole.clear();
|
||||
int printCount = ConsoleBuffer.getCycleBufferSize() / in.length();
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.execution.impl;
|
||||
import com.intellij.execution.process.ProcessOutputType;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Assert;
|
||||
|
||||
@@ -96,7 +96,7 @@ public class MockProcessStreamsSynchronizerTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testPerformanceSingleStream() {
|
||||
PerformanceTestUtil.newPerformanceTest("single stream", () -> {
|
||||
Benchmark.newBenchmark("single stream", () -> {
|
||||
mySynchronizer = new MockProcessStreamsSynchronizer(getTestRootDisposable());
|
||||
long nowTimeMillis = 10;
|
||||
for (int i = 0; i < 10_000_000; i++) {
|
||||
@@ -120,7 +120,7 @@ public class MockProcessStreamsSynchronizerTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testPerformanceTwoStreams() {
|
||||
PerformanceTestUtil.newPerformanceTest("two streams", () -> {
|
||||
Benchmark.newBenchmark("two streams", () -> {
|
||||
mySynchronizer = new MockProcessStreamsSynchronizer(getTestRootDisposable());
|
||||
long nowTimeMillis = 10;
|
||||
for (int i = 0; i < 10_000_000; i++) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -287,7 +287,7 @@ public class AnsiEscapeDecoderTest extends LightPlatformTestCase {
|
||||
|
||||
//noinspection CodeBlock2Expr
|
||||
withProcessHandlerFrom(testProcess, handler -> {
|
||||
PerformanceTestUtil.newPerformanceTest("ansi color", () -> {
|
||||
Benchmark.newBenchmark("ansi color", () -> {
|
||||
for (int i = 0; i < 2_000_000; i++) {
|
||||
handler.notifyTextAvailable(i + "Chrome 35.0.1916 (Linux): Executed 0 of 1\u001B[32m SUCCESS\u001B[39m (0 secs / 0 secs)\n",
|
||||
ProcessOutputTypes.STDOUT);
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LoggedErrorProcessor;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.TestTimeOut;
|
||||
@@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class IdeEventQueueTest extends LightPlatformTestCase {
|
||||
public void testManyEventsStress() {
|
||||
int N = 100000;
|
||||
PerformanceTestUtil.newPerformanceTest("Event queue dispatch", () -> {
|
||||
Benchmark.newBenchmark("Event queue dispatch", () -> {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
for (int i = 0; i < N; i++) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.openapi.util.IntRef
|
||||
import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.psi.impl.cache.impl.id.IdTableBuilding
|
||||
import com.intellij.testFramework.LexerTestCase
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.annotations.NonNls
|
||||
|
||||
@@ -508,7 +508,7 @@ NUMBER ('0yabc0')
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(name) {
|
||||
Benchmark.newBenchmark(name) {
|
||||
val charAts = IntRef()
|
||||
LexerTestCase.printTokens(countingCharSequence(text, charAts), 0, CustomFileTypeLexer(table))
|
||||
assertTrue(charAts.get() < text.length * 4)
|
||||
|
||||
@@ -21,7 +21,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.RunFirst;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
@@ -78,7 +78,7 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
ThreadingAssertions.assertEventDispatchThread();
|
||||
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("lock/unlock " + getTestName(false), () -> {
|
||||
Benchmark.newBenchmark("lock/unlock " + getTestName(false), () -> {
|
||||
final int numOfThreads = JobSchedulerImpl.getJobPoolParallelism();
|
||||
List<Job<Void>> threads = new ArrayList<>(numOfThreads);
|
||||
for (int i = 0; i < numOfThreads; i++) {
|
||||
@@ -488,7 +488,7 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
}
|
||||
});
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("RWLock/unlock", ()-> {
|
||||
Benchmark.newBenchmark("RWLock/unlock", ()-> {
|
||||
ThreadingAssertions.assertEventDispatchThread();
|
||||
assertFalse(ApplicationManager.getApplication().isWriteAccessAllowed());
|
||||
List<Future<Void>> futures = AppExecutorUtil.getAppExecutorService().invokeAll(callables);
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.concurrency.ThreadingAssertions;
|
||||
@@ -591,7 +591,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase {
|
||||
AtomicInteger counter = new AtomicInteger();
|
||||
Runnable r = () -> counter.incrementAndGet();
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (int i = 0; i < N; i++) {
|
||||
if (i % 8192 == 0) {
|
||||
// decrease GC pressure, we're not measuring that
|
||||
@@ -609,7 +609,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase {
|
||||
int N = 1_000_000;
|
||||
AtomicInteger counter = new AtomicInteger();
|
||||
Runnable r = () -> counter.incrementAndGet();
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
Application application = ApplicationManager.getApplication();
|
||||
for (int i = 0; i < N; i++) {
|
||||
if (i % 8192 == 0) {
|
||||
@@ -630,7 +630,7 @@ public class LaterInvocatorTest extends HeavyPlatformTestCase {
|
||||
Runnable r = () -> counter.incrementAndGet();
|
||||
Application application = ApplicationManager.getApplication();
|
||||
application.invokeAndWait(r);
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
counter.set(0);
|
||||
UIUtil.invokeAndWaitIfNeeded(() -> LaterInvocator.enterModal(myWindow1));
|
||||
for (int i = 0; i < N; i++) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.intellij.testFramework.LeakHunter;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LoggedErrorProcessor;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
@@ -402,7 +402,7 @@ public class NonBlockingReadActionTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testCancellationPerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest("NBRA cancellation", () -> {
|
||||
Benchmark.newBenchmark("NBRA cancellation", () -> {
|
||||
WriteAction.run(() -> {
|
||||
for (int i = 0; i < 100_000; i++) {
|
||||
ReadAction.nonBlocking(() -> {}).coalesceBy(this).submit(AppExecutorUtil.getAppExecutorService()).cancel();
|
||||
|
||||
@@ -18,13 +18,13 @@ package com.intellij.openapi.editor;
|
||||
import com.intellij.openapi.editor.impl.AbstractEditorTest;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
|
||||
public class EditorCreationPerformanceTest extends AbstractEditorTest {
|
||||
public void testOpeningEditorWithManyLines() {
|
||||
Document document = EditorFactory.getInstance().createDocument(StringUtil.repeat(LOREM_IPSUM + '\n', 15000));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Editor creation", () -> {
|
||||
Benchmark.newBenchmark("Editor creation", () -> {
|
||||
Editor editor = EditorFactory.getInstance().createEditor(document);
|
||||
try {
|
||||
LOG.debug(String.valueOf(editor.getContentComponent().getPreferredSize()));
|
||||
@@ -42,7 +42,7 @@ public class EditorCreationPerformanceTest extends AbstractEditorTest {
|
||||
public void testOpeningEditorWithLongLine() {
|
||||
Document document = EditorFactory.getInstance().createDocument(StringUtil.repeat(LOREM_IPSUM, 30000));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Editor creation", () -> {
|
||||
Benchmark.newBenchmark("Editor creation", () -> {
|
||||
Editor editor = EditorFactory.getInstance().createEditor(document);
|
||||
try {
|
||||
EditorTestUtil.setEditorVisibleSize(editor, 100, 100);
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.intellij.openapi.editor;
|
||||
import com.intellij.openapi.editor.impl.AbstractEditorTest;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
|
||||
public class EditorMultiCaretPerformanceTest extends AbstractEditorTest {
|
||||
public void testTyping() {
|
||||
@@ -26,7 +26,7 @@ public class EditorMultiCaretPerformanceTest extends AbstractEditorTest {
|
||||
int charactersToType = 100;
|
||||
String initialText = StringUtil.repeat("<caret>\n", caretCount);
|
||||
initText(initialText);
|
||||
PerformanceTestUtil.newPerformanceTest("Typing with large number of carets", () -> {
|
||||
Benchmark.newBenchmark("Typing with large number of carets", () -> {
|
||||
for (int i = 0; i < charactersToType; i++) {
|
||||
type('a');
|
||||
}
|
||||
@@ -44,7 +44,7 @@ public class EditorMultiCaretPerformanceTest extends AbstractEditorTest {
|
||||
addFoldRegion(getEditor().getDocument().getLineStartOffset(i), getEditor().getDocument().getLineEndOffset(i), "...");
|
||||
}
|
||||
});
|
||||
PerformanceTestUtil.newPerformanceTest("Typing with large number of carets with a lot of fold regions", () -> {
|
||||
Benchmark.newBenchmark("Typing with large number of carets with a lot of fold regions", () -> {
|
||||
for (int i = 0; i < charactersToType; i++) {
|
||||
type('a');
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public class EditorMultiCaretPerformanceTest extends AbstractEditorTest {
|
||||
int charactersToType = 100;
|
||||
String initialText = "<root>\n" + StringUtil.repeat(" <node><caret></node>\n", caretCount) + "</root>";
|
||||
init(initialText, StdFileTypes.XML);
|
||||
PerformanceTestUtil.newPerformanceTest("Typing in XML with large number of carets", () -> {
|
||||
Benchmark.newBenchmark("Typing in XML with large number of carets", () -> {
|
||||
for (int i = 0; i < charactersToType; i++) {
|
||||
type('a');
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.openapi.editor.impl.AbstractEditorTest;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EditorPaintingPerformanceTest extends AbstractEditorTest {
|
||||
EditorImpl editor = (EditorImpl)getEditor();
|
||||
int editorHeight = editor.getPreferredHeight();
|
||||
int[] result = {0};
|
||||
PerformanceTestUtil.newPerformanceTest(message, () -> {
|
||||
Benchmark.newBenchmark(message, () -> {
|
||||
for (int y = 0; y < editorHeight; y += 1000) {
|
||||
Rectangle clip = new Rectangle(0, y, EDITOR_WIDTH_PX, 1000);
|
||||
NullGraphics2D g = new NullGraphics2D(clip);
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.openapi.editor.impl.AbstractEditorTest;
|
||||
import com.intellij.openapi.editor.markup.HighlighterTargetArea;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -19,7 +19,7 @@ public class EditorPerformanceTest extends AbstractEditorTest {
|
||||
getEditor().getMarkupModel().addRangeHighlighter(offset, offset + 1, 0, attributes, HighlighterTargetArea.EXACT_RANGE);
|
||||
}
|
||||
getEditor().getCaretModel().moveToOffset(0);
|
||||
PerformanceTestUtil.newPerformanceTest("Editing with a lot of highlighters", () -> {
|
||||
Benchmark.newBenchmark("Editing with a lot of highlighters", () -> {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
executeAction(IdeActions.ACTION_EDITOR_ENTER);
|
||||
UIUtil.dispatchAllInvocationEvents(); // let gutter update its width
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.openapi.editor.ex.FoldingModelEx;
|
||||
import com.intellij.openapi.editor.impl.DocumentImpl;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
|
||||
public class FoldingStressTest extends LightPlatformTestCase {
|
||||
|
||||
@@ -87,7 +87,7 @@ public class FoldingStressTest extends LightPlatformTestCase {
|
||||
Editor editor = EditorFactory.getInstance().createEditor(doc);
|
||||
try {
|
||||
FoldingModelEx model = (FoldingModelEx)editor.getFoldingModel();
|
||||
PerformanceTestUtil.newPerformanceTest("restoring many fold regions", () -> model.runBatchFoldingOperation(() -> {
|
||||
Benchmark.newBenchmark("restoring many fold regions", () -> model.runBatchFoldingOperation(() -> {
|
||||
for (int i = 0; i < N; i++) {
|
||||
addAndCollapseFoldRegion(model, i, i+1, "/*...*/");
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.openapi.editor.impl;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.JUnit38AssumeSupportRunner;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import org.jetbrains.jetCheck.Generator;
|
||||
import org.jetbrains.jetCheck.PropertyChecker;
|
||||
@@ -56,7 +56,7 @@ public class LineSetIncrementalUpdateTest extends UsefulTestCase {
|
||||
|
||||
public void testTypingInLongLinePerformance() {
|
||||
String longLine = StringUtil.repeat("a ", 200000);
|
||||
PerformanceTestUtil.newPerformanceTest("Document changes in a long line", () -> {
|
||||
Benchmark.newBenchmark("Document changes in a long line", () -> {
|
||||
Document document = new DocumentImpl("a\n" + longLine + "<caret>" + longLine + "\n", true);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
int offset = i * 2 + longLine.length();
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.PsiDocumentManagerImpl;
|
||||
import com.intellij.psi.impl.PsiToDocumentSynchronizer;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.TestTimeOut;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
@@ -1123,7 +1123,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
}
|
||||
markupModel.addRangeHighlighter(null, N / 2, N / 2 + 1, 0, HighlighterTargetArea.LINES_IN_RANGE);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("highlighters lookup", () -> {
|
||||
Benchmark.newBenchmark("highlighters lookup", () -> {
|
||||
List<RangeHighlighterEx> list = new ArrayList<>();
|
||||
CommonProcessors.CollectProcessor<RangeHighlighterEx> coll = new CommonProcessors.CollectProcessor<>(list);
|
||||
for (int i=0; i<N-1;i++) {
|
||||
@@ -1329,7 +1329,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
RangeMarker marker = doc.createRangeMarker(start, end);
|
||||
markers.add(marker);
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest("RM.getStartOffset", ()->{
|
||||
Benchmark.newBenchmark("RM.getStartOffset", ()->{
|
||||
insertString(doc, 0, " ");
|
||||
for (int i=0; i<1000; i++) {
|
||||
for (RangeMarker rm : markers) {
|
||||
@@ -1352,7 +1352,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
RangeMarker marker = doc.createRangeMarker(start, end);
|
||||
markers.add(marker);
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest("RM.getStartOffset", ()->{
|
||||
Benchmark.newBenchmark("RM.getStartOffset", ()->{
|
||||
insertString(doc, 0, " ");
|
||||
for (int i=0; i<1000; i++) {
|
||||
for (int j = 0; j < markers.size(); j++) {
|
||||
@@ -1377,7 +1377,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
RangeMarker marker = doc.createRangeMarker(start, end);
|
||||
markers.add(marker);
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest("insert/delete string", ()->{
|
||||
Benchmark.newBenchmark("insert/delete string", ()->{
|
||||
for (int i=0; i<15000; i++) {
|
||||
insertString(doc, 0, " ");
|
||||
deleteString(doc, 0, 1);
|
||||
@@ -1392,7 +1392,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
DocumentEx doc = new DocumentImpl(StringUtil.repeat("blah", 1000));
|
||||
int N = 100_000;
|
||||
List<RangeMarker> markers = new ArrayList<>(N);
|
||||
PerformanceTestUtil.newPerformanceTest("createRM", ()->{
|
||||
Benchmark.newBenchmark("createRM", ()->{
|
||||
for (int i = 0; i < N; i++) {
|
||||
int start = i % doc.getTextLength();
|
||||
int end = start + 1;
|
||||
@@ -1415,7 +1415,7 @@ public class RangeMarkerTest extends LightPlatformTestCase {
|
||||
RangeMarker marker = doc.createRangeMarker(start, end);
|
||||
markers.add(marker);
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), ()->{
|
||||
Benchmark.newBenchmark(getTestName(false), ()->{
|
||||
for (int it = 0; it < 2_000; it++) {
|
||||
for (int i = 1; i < doc.getTextLength() - 1; i++) {
|
||||
boolean result = doc.processRangeMarkersOverlappingWith(i, i + 1, __ -> false);
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.wm.ex.ProgressIndicatorEx;
|
||||
import com.intellij.testFramework.BombedProgressIndicator;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
@@ -341,7 +341,7 @@ public class ProgressIndicatorTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testProgressPerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest("executeProcessUnderProgress", () -> {
|
||||
Benchmark.newBenchmark("executeProcessUnderProgress", () -> {
|
||||
EmptyProgressIndicator indicator = new EmptyProgressIndicator();
|
||||
for (int i=0;i<100000;i++) {
|
||||
ProgressManager.getInstance().executeProcessUnderProgress(EmptyRunnable.getInstance(), indicator);
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.openapi.vfs.findFileOrDirectory
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.PsiTestUtil
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.testFramework.junit5.RunInEdt
|
||||
@@ -175,7 +175,7 @@ class IteratingContentUnderExcludedTest {
|
||||
IoTestUtil.assumeSymLinkCreationIsSupported()
|
||||
val root = projectModel.baseProjectDir.virtualFileRoot
|
||||
generateSymlinkExplosion(VfsUtilCore.virtualToIoFile(root), 17)
|
||||
PerformanceTestUtil.newPerformanceTest("traversing non-project roots") { checkIterate(root) }.start()
|
||||
Benchmark.newBenchmark("traversing non-project roots") { checkIterate(root) }.start()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.platform.backend.workspace.toVirtualFileUrl
|
||||
import com.intellij.platform.workspace.jps.entities.*
|
||||
import com.intellij.platform.workspace.storage.MutableEntityStorage
|
||||
import com.intellij.testFramework.LightVirtualFile
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.PsiTestUtil
|
||||
import com.intellij.testFramework.VfsTestUtil
|
||||
import com.intellij.testFramework.junit5.TestApplication
|
||||
@@ -135,7 +135,7 @@ class ProjectFileIndexPerformanceTest {
|
||||
}
|
||||
val filesWithoutId = arrayOf(noId1, noId2, noId3)
|
||||
val fsRoot = VirtualFileManager.getInstance().findFileByUrl("temp:///")!!
|
||||
PerformanceTestUtil.newPerformanceTest("Checking status of source files in ProjectFileIndex") {
|
||||
Benchmark.newBenchmark("Checking status of source files in ProjectFileIndex") {
|
||||
runReadAction {
|
||||
repeat(100) {
|
||||
assertFalse(fileIndex.isInContent(fsRoot))
|
||||
@@ -157,7 +157,7 @@ class ProjectFileIndexPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `access to excluded files`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Checking status of excluded files in ProjectFileIndex") {
|
||||
Benchmark.newBenchmark("Checking status of excluded files in ProjectFileIndex") {
|
||||
runReadAction {
|
||||
repeat(10) {
|
||||
for (file in ourExcludedFilesToTest) {
|
||||
@@ -172,7 +172,7 @@ class ProjectFileIndexPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `access to library files`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Checking status of library files in ProjectFileIndex") {
|
||||
Benchmark.newBenchmark("Checking status of library files in ProjectFileIndex") {
|
||||
runReadAction {
|
||||
repeat(10) {
|
||||
for (file in ourLibraryFilesToTest) {
|
||||
@@ -193,7 +193,7 @@ class ProjectFileIndexPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `access to library source files`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Checking status of library source files in ProjectFileIndex") {
|
||||
Benchmark.newBenchmark("Checking status of library source files in ProjectFileIndex") {
|
||||
runReadAction {
|
||||
repeat(10) {
|
||||
for (file in ourLibrarySourceFilesToTest) {
|
||||
@@ -216,7 +216,7 @@ class ProjectFileIndexPerformanceTest {
|
||||
fun `access to index after change`() {
|
||||
val newRoot = runWriteActionAndWait { ourProjectRoot.subdir("newContentRoot") }
|
||||
val module = ourProjectModel.moduleManager.findModuleByName("big")!!
|
||||
PerformanceTestUtil.newPerformanceTest("Checking status of file after adding and removing content root") {
|
||||
Benchmark.newBenchmark("Checking status of file after adding and removing content root") {
|
||||
runReadAction {
|
||||
repeat(50) {
|
||||
assertFalse(fileIndex.isInContent(newRoot))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.openapi.util.io;
|
||||
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@@ -16,7 +16,7 @@ public class FileUtilPerformanceTest {
|
||||
public void toCanonicalPath() {
|
||||
assertEquals(myCanonicalPath, FileUtil.toCanonicalPath(myTestPath));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("toCanonicalPath", () -> {
|
||||
Benchmark.newBenchmark("toCanonicalPath", () -> {
|
||||
for (int i = 0; i < 1000000; ++i) {
|
||||
final String canonicalPath = FileUtil.toCanonicalPath(myTestPath, '/');
|
||||
assert canonicalPath.length() == 18 : canonicalPath;
|
||||
@@ -28,7 +28,7 @@ public class FileUtilPerformanceTest {
|
||||
public void toCanonicalPathSimple() {
|
||||
assertEquals(mySimpleTestPath, FileUtil.toCanonicalPath(mySimpleTestPath));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("toCanonicalPathSimple", () -> {
|
||||
Benchmark.newBenchmark("toCanonicalPathSimple", () -> {
|
||||
for (int i = 0; i < 1000000; ++i) {
|
||||
final String canonicalPath = FileUtil.toCanonicalPath(mySimpleTestPath, '/');
|
||||
assert canonicalPath.length() == 8 : canonicalPath;
|
||||
@@ -40,7 +40,7 @@ public class FileUtilPerformanceTest {
|
||||
public void isAncestor() {
|
||||
assertTrue(FileUtil.isAncestor(myTestPath, myCanonicalPath, false));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("isAncestor", () -> {
|
||||
Benchmark.newBenchmark("isAncestor", () -> {
|
||||
for (int i = 0; i < 1000000; ++i) {
|
||||
assert FileUtil.isAncestor(myTestPath, myCanonicalPath, false);
|
||||
assert !FileUtil.isAncestor(myTestPath, myCanonicalPath, true);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.openapi.util.text;
|
||||
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Random;
|
||||
@@ -29,7 +29,7 @@ public class StringUtilPerformanceTest {
|
||||
public void containsAnyChar() {
|
||||
assertTrue(StringUtil.containsAnyChar(TEST_STRING, Integer.toString(new Random().nextInt())));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("StringUtil.containsAnyChar()", () -> {
|
||||
Benchmark.newBenchmark("StringUtil.containsAnyChar()", () -> {
|
||||
for (int i = 0; i < 1_000_000; i++) {
|
||||
if (StringUtil.containsAnyChar(TEST_STRING, "XYZ")) {
|
||||
throw new AssertionError();
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.openapi.vfs
|
||||
|
||||
import com.intellij.openapi.application.PathManager
|
||||
import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Before
|
||||
@@ -20,7 +20,7 @@ class ArchiveFileSystemPerformanceTest : BareTestFixtureTestCase() {
|
||||
|
||||
@Test fun getRootByEntry() {
|
||||
val root = fs.getRootByEntry(entry)!!
|
||||
PerformanceTestUtil.newPerformanceTest("ArchiveFileSystem.getRootByEntry()") {
|
||||
Benchmark.newBenchmark("ArchiveFileSystem.getRootByEntry()") {
|
||||
for (i in 0..100000) {
|
||||
assertEquals(root, fs.getRootByEntry(entry))
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class ArchiveFileSystemPerformanceTest : BareTestFixtureTestCase() {
|
||||
|
||||
@Test fun getLocalByEntry() {
|
||||
val local = fs.getLocalByEntry(entry)!!
|
||||
PerformanceTestUtil.newPerformanceTest("ArchiveFileSystem.getLocalByEntry()") {
|
||||
Benchmark.newBenchmark("ArchiveFileSystem.getLocalByEntry()") {
|
||||
for (i in 0..100000) {
|
||||
assertEquals(local, fs.getLocalByEntry(entry))
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.intellij.testFramework.*;
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
|
||||
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
|
||||
import com.intellij.testFramework.rules.TempDirectory;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ExceptionUtil;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -84,7 +84,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
UIUtil.pump(); // wait for all event handlers to calm down
|
||||
|
||||
Logger.getInstance(VfsUtilPerformanceTest.class).debug("Start searching...");
|
||||
PerformanceTestUtil.newPerformanceTest("finding child", () -> {
|
||||
Benchmark.newBenchmark("finding child", () -> {
|
||||
for (int i = 0; i < 1_000_000; i++) {
|
||||
VirtualFile child = vDir.findChild("5111.txt");
|
||||
assertEquals(theChild, child);
|
||||
@@ -108,8 +108,8 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
String path = jar.getPath() + "!/";
|
||||
ManagingFS managingFS = ManagingFS.getInstance();
|
||||
NewVirtualFile root = managingFS.findRoot(path, fs);
|
||||
PerformanceTestUtil.newPerformanceTest("finding root",
|
||||
() -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress(
|
||||
Benchmark.newBenchmark("finding root",
|
||||
() -> JobLauncher.getInstance().invokeConcurrentlyUnderProgress(
|
||||
Collections.nCopies(500, null), null,
|
||||
__ -> {
|
||||
for (int i = 0; i < 100_000; i++) {
|
||||
@@ -153,7 +153,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
}
|
||||
};
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("getParent before movement", checkPerformance)
|
||||
Benchmark.newBenchmark("getParent before movement", checkPerformance)
|
||||
.start(getQualifiedTestMethodName() + " - getParent before movement");
|
||||
|
||||
VirtualFile dir1 = root.createChildDirectory(this, "dir1");
|
||||
@@ -162,7 +162,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
dir1.createChildData(this, "a" + i + ".txt").move(this, dir2);
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("getParent after movement", checkPerformance)
|
||||
Benchmark.newBenchmark("getParent after movement", checkPerformance)
|
||||
.start(getQualifiedTestMethodName() + " - getParent after movement");
|
||||
});
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
"fff.txt";
|
||||
VirtualFile file = fixture.findOrCreateDir(path);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("VF.getPath()", () -> {
|
||||
Benchmark.newBenchmark("VF.getPath()", () -> {
|
||||
for (int i = 0; i < 1_000_000; ++i) {
|
||||
file.getPath();
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
VirtualDirectoryImpl temp = createTempFsDirectory();
|
||||
|
||||
EdtTestUtil.runInEdtAndWait(() -> {
|
||||
PerformanceTestUtil.newPerformanceTest("many files creations", () -> {
|
||||
Benchmark.newBenchmark("many files creations", () -> {
|
||||
assertEquals(N, events.size());
|
||||
processEvents(events);
|
||||
assertEquals(N, temp.getCachedChildren().size());
|
||||
@@ -287,7 +287,7 @@ public class VfsUtilPerformanceTest extends BareTestFixtureTestCase {
|
||||
})
|
||||
.start(getQualifiedTestMethodName() + " - many files creations");
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("many files deletions", () -> {
|
||||
Benchmark.newBenchmark("many files deletions", () -> {
|
||||
assertEquals(N, events.size());
|
||||
processEvents(events);
|
||||
assertEquals(0, temp.getCachedChildren().size());
|
||||
|
||||
@@ -44,7 +44,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.refactoring.copy.CopyFilesOrDirectoriesHandler;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
@@ -1021,7 +1021,7 @@ public class FileEncodingTest extends HeavyPlatformTestCase implements TestDialo
|
||||
WriteCommandAction.runWriteCommandAction(myProject, () -> document.insertString(0, " "));
|
||||
EncodingManagerImpl encodingManager = (EncodingManagerImpl)EncodingManager.getInstance();
|
||||
encodingManager.waitAllTasksExecuted();
|
||||
PerformanceTestUtil.newPerformanceTest("encoding re-detect requests", ()->{
|
||||
Benchmark.newBenchmark("encoding re-detect requests", ()->{
|
||||
for (int i=0; i<100_000_000;i++) {
|
||||
encodingManager.queueUpdateEncodingFromContent(document);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointerListener;
|
||||
import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -72,7 +72,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testContainerCreateDeletePerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
Disposable parent = Disposer.newDisposable();
|
||||
for (int i = 0; i < 100_000; i++) {
|
||||
myVirtualFilePointerManager.createContainer(parent);
|
||||
@@ -88,7 +88,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase {
|
||||
String url = VfsUtilCore.pathToUrl(f.getPath());
|
||||
VirtualFilePointer thePointer = myVirtualFilePointerManager.create(url, disposable, listener);
|
||||
assertNotNull(TempFileSystem.getInstance());
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (int i = 0; i < 1_000_000; i++) {
|
||||
VirtualFilePointer pointer = myVirtualFilePointerManager.create(url, disposable, listener);
|
||||
assertSame(pointer, thePointer);
|
||||
@@ -107,7 +107,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase {
|
||||
VirtualFile v = refreshAndFindFile(f);
|
||||
VirtualFilePointer thePointer = myVirtualFilePointerManager.create(v, disposable, listener);
|
||||
assertNotNull(TempFileSystem.getInstance());
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (int i = 0; i < 10_000_000; i++) {
|
||||
VirtualFilePointer pointer = myVirtualFilePointerManager.create(v, disposable, listener);
|
||||
assertSame(pointer, thePointer);
|
||||
@@ -130,7 +130,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase {
|
||||
String name = "xxx" + (i % 20);
|
||||
events.add(new VFileCreateEvent(this, temp, name, true, null, null, null));
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
// simulate VFS refresh events since launching the actual refresh is too slow
|
||||
AsyncFileListener.ChangeApplier applier = myVirtualFilePointerManager.prepareChange(events);
|
||||
@@ -163,7 +163,7 @@ public class VirtualFilePointerRootsTest extends HeavyPlatformTestCase {
|
||||
|
||||
PersistentFSImpl persistentFS = (PersistentFSImpl)ManagingFS.getInstance();
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
for (int i = 0; i < 500_000; i++) {
|
||||
persistentFS.incStructuralModificationCount();
|
||||
AsyncFileListener.ChangeApplier applier = myVirtualFilePointerManager.prepareChange(createEvents);
|
||||
|
||||
@@ -33,7 +33,7 @@ import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
|
||||
import com.intellij.testFramework.*;
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
|
||||
import com.intellij.testFramework.rules.TempDirectory;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.io.SuperUserStatus;
|
||||
@@ -1125,7 +1125,7 @@ public class VirtualFilePointerTest extends BareTestFixtureTestCase {
|
||||
assertNotNull(pointer.getFile());
|
||||
assertTrue(pointer.getFile().isValid());
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("get()", () -> {
|
||||
Benchmark.newBenchmark("get()", () -> {
|
||||
for (int i=0; i<200_000_000; i++) {
|
||||
assertNotNull(pointer.getFile());
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.openapi.vfs.local.FileWatcherTestUtil.refresh
|
||||
import com.intellij.openapi.vfs.local.FileWatcherTestUtil.shutdown
|
||||
import com.intellij.openapi.vfs.local.FileWatcherTestUtil.startup
|
||||
import com.intellij.openapi.vfs.local.FileWatcherTestUtil.wait
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.RunAll
|
||||
import com.intellij.testFramework.SkipSlowTestLocally
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase
|
||||
@@ -78,7 +78,7 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() {
|
||||
try {
|
||||
val roots = (1..fileCount).map { "${root}/f${it}" }
|
||||
val requests = ArrayList<LocalFileSystem.WatchRequest>(fileCount)
|
||||
PerformanceTestUtil.newPerformanceTest("Adding roots") {
|
||||
Benchmark.newBenchmark("Adding roots") {
|
||||
roots.forEach {
|
||||
requests.add(fs.addRootToWatch(it, true)!!)
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() {
|
||||
|
||||
try {
|
||||
val roots = (1..fileCount).map { "${root}/f${it}" }
|
||||
PerformanceTestUtil.newPerformanceTest("Adding roots") {
|
||||
Benchmark.newBenchmark("Adding roots") {
|
||||
fs.removeWatchedRoots(fs.addRootsToWatch(roots, true))
|
||||
}.start()
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() {
|
||||
|
||||
try {
|
||||
val rootPath = root.toString()
|
||||
PerformanceTestUtil.newPerformanceTest("Adding roots") {
|
||||
Benchmark.newBenchmark("Adding roots") {
|
||||
fs.removeWatchedRoot(fs.addRootToWatch(rootPath, true)!!)
|
||||
}.start()
|
||||
}
|
||||
@@ -138,13 +138,13 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() {
|
||||
(1..5).forEach { pathMappings.add(Pair("$root/rec$i/ln$it", "$root/targets/rec$i/ln$it")) }
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Create canonical path map") {
|
||||
Benchmark.newBenchmark("Create canonical path map") {
|
||||
repeat(18) {
|
||||
WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, false)
|
||||
}
|
||||
}.startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Create canonical path map - convert paths") {
|
||||
Benchmark.newBenchmark("Create canonical path map - convert paths") {
|
||||
repeat(18) {
|
||||
WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, true)
|
||||
}
|
||||
@@ -167,19 +167,19 @@ class WatchRootsManagerPerformanceTest : BareTestFixtureTestCase() {
|
||||
|
||||
val map = WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, false)
|
||||
map.addMapping((1..filesCount).map { Pair("$root/src/ln$it-3", "$root/src/ln$it-3") })
|
||||
PerformanceTestUtil.newPerformanceTest("Test apply mapping from canonical path map") {
|
||||
Benchmark.newBenchmark("Test apply mapping from canonical path map") {
|
||||
repeat(1_000_000) {
|
||||
map.mapToOriginalWatchRoots("$root/src/ln${(Math.random() * 200_000).toInt()}", true)
|
||||
}
|
||||
}.startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Create canonical path map") {
|
||||
Benchmark.newBenchmark("Create canonical path map") {
|
||||
repeat(100) {
|
||||
WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, false)
|
||||
}
|
||||
}.startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Create canonical path map - convert paths") {
|
||||
Benchmark.newBenchmark("Create canonical path map - convert paths") {
|
||||
repeat(40) {
|
||||
WatchRootsManager.createCanonicalPathMap(flatWatchRoots, optimizedRecursiveWatchRoots, pathMappings, true)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
|
||||
import com.intellij.testFramework.rules.TempDirectory;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -899,7 +899,7 @@ public class LocalFileSystemTest extends BareTestFixtureTestCase {
|
||||
@Test
|
||||
public void testFindFileByUrlPerformance() {
|
||||
VirtualFileManager virtualFileManager = VirtualFileManager.getInstance();
|
||||
PerformanceTestUtil.newPerformanceTest("findFileByUrl", () -> {
|
||||
Benchmark.newBenchmark("findFileByUrl", () -> {
|
||||
for (int i=0; i<10_000_000;i++) {
|
||||
assertNull(virtualFileManager.findFileByUrl("temp://"));
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.ex.temp.TempFileSystem;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.BareTestFixtureTestCase;
|
||||
import com.intellij.testFramework.rules.TempDirectory;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -32,7 +32,7 @@ public class LocalFileSystemStressTest extends BareTestFixtureTestCase {
|
||||
assertThat(tmpRoot.getFileSystem()).isInstanceOf(TempFileSystem.class);
|
||||
VirtualFile testDir = WriteAction.computeAndWait(() -> tmpRoot.createChildDirectory(this, getTestName(true)));
|
||||
int N_LEVELS = 1_000_000;
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
UIUtil.pump();
|
||||
StringBuilder expectedPath = new StringBuilder(N_LEVELS*4+100);
|
||||
expectedPath.append(testDir.getPath());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.vfs.newvfs.persistent
|
||||
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.junit5.TestApplication
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -14,7 +14,7 @@ class VFSInitializationBenchmarkTest {
|
||||
@Test
|
||||
@Throws(Exception::class)
|
||||
fun benchmarkVfsInitializationTime_CreateVfsFromScratch(@TempDir temporaryDirectory: Path) {
|
||||
PerformanceTestUtil.newPerformanceTest("create VFS from scratch") {
|
||||
Benchmark.newBenchmark("create VFS from scratch") {
|
||||
val cachesDir: Path = temporaryDirectory
|
||||
val version = 1
|
||||
|
||||
@@ -40,7 +40,7 @@ class VFSInitializationBenchmarkTest {
|
||||
)
|
||||
PersistentFSConnector.disconnect(result.connection)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("open existing VFS files") {
|
||||
Benchmark.newBenchmark("open existing VFS files") {
|
||||
val initResult = PersistentFSConnector.connectWithoutVfsLog(
|
||||
cachesDir,
|
||||
version
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.text.StringSearcher;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
@@ -44,7 +44,7 @@ public class LowLevelSearchUtilTest extends TestCase {
|
||||
IntList found = new IntArrayList(new int[]{-1});
|
||||
CharSequence text = StringUtil.repeat("xxx z ", 1000000);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("processTextOccurrences", ()-> {
|
||||
Benchmark.newBenchmark("processTextOccurrences", ()-> {
|
||||
for (int i=0; i<10000; i++) {
|
||||
found.removeInt(0);
|
||||
int startOffset = text.length() / 2 + i % 20;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.intellij.psi.tree;
|
||||
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Before;
|
||||
@@ -116,7 +116,7 @@ public class TokenSetTest {
|
||||
final TokenSet set = TokenSet.create();
|
||||
final int shift = new Random().nextInt(500000);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("TokenSet.contains()", () -> {
|
||||
Benchmark.newBenchmark("TokenSet.contains()", () -> {
|
||||
for (int i = 0; i < 1000000; i++) {
|
||||
final IElementType next = elementTypes[(i + shift) % elementTypes.length];
|
||||
assertFalse(set.contains(next));
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.psi.util;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.MinusculeMatcher;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -28,7 +28,7 @@ public class MinusculeMatcherPerformanceTest extends TestCase {
|
||||
nonMatching.add(NameUtil.buildMatcher(s, NameUtil.MatchingCaseSensitivity.NONE));
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Matching", () -> {
|
||||
Benchmark.newBenchmark("Matching", () -> {
|
||||
for (int i = 0; i < 100_000; i++) {
|
||||
for (MinusculeMatcher matcher : matching) {
|
||||
Assert.assertTrue(matcher.matches(longName));
|
||||
@@ -42,7 +42,7 @@ public class MinusculeMatcherPerformanceTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testOnlyUnderscoresPerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
String small = StringUtil.repeat("_", 50000);
|
||||
String big = StringUtil.repeat("_", small.length() + 1);
|
||||
assertMatches("*" + small, big);
|
||||
@@ -51,7 +51,7 @@ public class MinusculeMatcherPerformanceTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testRepeatedLetterPerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
String big = StringUtil.repeat("Aaaaaa", 50000);
|
||||
assertMatches("aaaaaaaaaaaaaaaaaaaaaaaa", big);
|
||||
assertDoesntMatch("aaaaaaaaaaaaaaaaaaaaaaaab", big);
|
||||
@@ -59,7 +59,7 @@ public class MinusculeMatcherPerformanceTest extends TestCase {
|
||||
}
|
||||
|
||||
public void testMatchingLongHtmlWithShortHtml() {
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
String pattern = "*<p> aaa <div id=\"a";
|
||||
String html =
|
||||
"<html> <body> <H2> <FONT SIZE=\"-1\"> com.sshtools.cipher</FONT> <BR> Class AES128Cbc</H2> <PRE> java.lang.Object <IMG SRC=\"../../../resources/inherit.gif\" ALT=\"extended by\">com.maverick.ssh.cipher.SshCipher <IMG SRC=\"../../../resources/inherit.gif\" ALT=\"extended by\">com.maverick.ssh.crypto.engines.CbcBlockCipher <IMG SRC=\"../../../resources/inherit.gif\" ALT=\"extended by\"><B>com.sshtools.cipher.AES128Cbc</B> </PRE> <HR> <DL> <DT>public class <B>AES128Cbc</B><DT>extends com.maverick.ssh.crypto.engines.CbcBlockCipher</DL> <P> This cipher can optionally be added to the J2SSH Maverick API. To add the ciphers from this package simply add them to the <A HREF=\"../../../com/maverick/ssh2/Ssh2Context.html\" title=\"class in com.maverick.ssh2\"><CODE>Ssh2Context</CODE></A> <blockquote><pre> import com.sshtools.cipher.*; </pre></blockquote> <P> <P> <DL> <DT><B>Version:</B></DT> <DD>Revision: 1.20</DD> </DL> <HR> </body> </html>";
|
||||
@@ -82,11 +82,11 @@ public class MinusculeMatcherPerformanceTest extends TestCase {
|
||||
}
|
||||
|
||||
private void assertDoesntMatchFast(String pattern, String name, String subTestName) {
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> assertDoesntMatch(pattern, name)).startAsSubtest(subTestName);
|
||||
Benchmark.newBenchmark(getName(), () -> assertDoesntMatch(pattern, name)).startAsSubtest(subTestName);
|
||||
}
|
||||
|
||||
public void testMatchingLongRuby() {
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
String pattern = "*# -*- coding: utf-8 -*-$:. unshift(\"/Library/RubyMotion/lib\")require 'motion/project'Motion::Project::App. setup do |app| # Use `rake config' to see complete project settings. app. sdk_version = '4. 3'end";
|
||||
String name = "# -*- coding: utf-8 -*-$:.unshift(\"/Library/RubyMotion/lib\")require 'motion/project'Motion::Project::App.setup do |app| # Use `rake config' to see complete project settings. app.sdk_version = '4.3' app.frameworks -= ['UIKit']end";
|
||||
assertDoesntMatch(pattern, name);
|
||||
@@ -96,7 +96,7 @@ public class MinusculeMatcherPerformanceTest extends TestCase {
|
||||
public void testLongStringMatchingWithItself() {
|
||||
String s =
|
||||
"the class with its attributes mapped to fields of records parsed by an {@link AbstractParser} or written by an {@link AbstractWriter}.";
|
||||
PerformanceTestUtil.newPerformanceTest(getName(), () -> {
|
||||
Benchmark.newBenchmark(getName(), () -> {
|
||||
assertMatches(s, s);
|
||||
assertMatches("*" + s, s);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.intellij.serviceContainer
|
||||
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.extensions.DefaultPluginDescriptor
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
@@ -16,7 +16,7 @@ class ConstructorInjectionTest {
|
||||
fun `light service getService() performance`() {
|
||||
val componentManager = TestComponentManager()
|
||||
assertThat(componentManager.getService(BarService::class.java)).isNotNull()
|
||||
PerformanceTestUtil.newPerformanceTest("getService() must be fast for cached service") {
|
||||
Benchmark.newBenchmark("getService() must be fast for cached service") {
|
||||
for (i in 0..30_000_000) {
|
||||
componentManager.getService(BarService::class.java)!!
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ui.FilePathSplittingPolicy;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -118,7 +118,7 @@ public class FileNameSplittingTest extends TestCase {
|
||||
public void testPerformance() {
|
||||
myPolicy = FilePathSplittingPolicy.SPLIT_BY_SEPARATOR;
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("FileNameSplitting", () -> {
|
||||
Benchmark.newBenchmark("FileNameSplitting", () -> {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
for (int j = 0; j < FILE.getPath().length(); j++)
|
||||
myPolicy.getPresentableName(FILE, j);
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.concurrency.ConcurrentCollectionFactory;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
@@ -93,7 +93,7 @@ class ConcurrentBitSetTest {
|
||||
PlatformTestUtil.assumeEnoughParallelism();
|
||||
int L = 128;
|
||||
int N = 10_000;
|
||||
PerformanceTestUtil.newPerformanceTest("testStressFineGrainedSmallSetModifications", () -> tortureParallelSetClear(L, N)).start();
|
||||
Benchmark.newBenchmark("testStressFineGrainedSmallSetModifications", () -> tortureParallelSetClear(L, N)).start();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -103,7 +103,7 @@ class ConcurrentBitSetTest {
|
||||
// todo ARM64 is slow for some reason
|
||||
int N = CpuArch.isArm64() ? 300 : 1000;
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("testStressCoarseGrainedBigSet", () -> tortureParallelSetClear(L, N)).start();
|
||||
Benchmark.newBenchmark("testStressCoarseGrainedBigSet", () -> tortureParallelSetClear(L, N)).start();
|
||||
}
|
||||
|
||||
private static void tortureParallelSetClear(int L, int N) {
|
||||
@@ -197,7 +197,7 @@ class ConcurrentBitSetTest {
|
||||
int N = 100_000;
|
||||
|
||||
ExecutorService executor = create4ThreadsExecutor();
|
||||
PerformanceTestUtil.newPerformanceTest("testParallelReadPerformance", ()-> {
|
||||
Benchmark.newBenchmark("testParallelReadPerformance", ()-> {
|
||||
Semaphore threadReady = new Semaphore();
|
||||
Set<Thread> threadUsed = ConcurrentCollectionFactory.createConcurrentSet();
|
||||
boundedParallelRun(executor, threadUsed, threadReady, N, __-> {
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Segment;
|
||||
import com.intellij.openapi.util.UnfairTextRange;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
@@ -178,7 +178,7 @@ public class ContainerUtilTest extends TestCase {
|
||||
List<Object> list = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
int count = 15000;
|
||||
List<Integer> ints = IntStreamEx.range(0, count).boxed().toList();
|
||||
PerformanceTestUtil.newPerformanceTest("COWList add", () -> {
|
||||
Benchmark.newBenchmark("COWList add", () -> {
|
||||
for (int it = 0; it < 10; it++) {
|
||||
list.clear();
|
||||
for (int i = 0; i < count; i++) {
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.util.io;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.ThrowableComputable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.rules.TempDirectory;
|
||||
import com.intellij.util.containers.IntObjectCache;
|
||||
import com.intellij.util.io.stats.FilePageCacheStatistics;
|
||||
@@ -225,7 +225,7 @@ public class PersistentBTreeEnumeratorTest {
|
||||
StorageLockContext.assertNoBuffersLocked();
|
||||
|
||||
FilePageCacheStatistics statsBefore = StorageLockContext.getStatistics();
|
||||
PerformanceTestUtil.newPerformanceTest("PersistentStringEnumerator", () -> {
|
||||
Benchmark.newBenchmark("PersistentStringEnumerator", () -> {
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
for (String item : data) {
|
||||
assertNotEquals(0, myEnumerator.tryEnumerate(item));
|
||||
@@ -327,7 +327,7 @@ public class PersistentBTreeEnumeratorTest {
|
||||
}
|
||||
};
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("PersistentStringEnumerator", () -> {
|
||||
Benchmark.newBenchmark("PersistentStringEnumerator", () -> {
|
||||
stringCache.addDeletedPairsListener(listener);
|
||||
for (int i = 0; i < 100000; ++i) {
|
||||
String string = createRandomString();
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.intellij.util.io;
|
||||
import com.intellij.idea.HardwareAgentRequired;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.containers.CollectionFactory;
|
||||
@@ -334,7 +334,7 @@ public class PersistentMapPerformanceTest extends PersistentMapTestBase {
|
||||
};
|
||||
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
PerformanceTestUtil.newPerformanceTest("put/remove", () -> {
|
||||
Benchmark.newBenchmark("put/remove", () -> {
|
||||
try {
|
||||
stringCache.addDeletedPairsListener(listener);
|
||||
for (int i = 0; i < 100000; ++i) {
|
||||
@@ -368,7 +368,7 @@ public class PersistentMapPerformanceTest extends PersistentMapTestBase {
|
||||
strings.add(createRandomString());
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("put/remove", () -> {
|
||||
Benchmark.newBenchmark("put/remove", () -> {
|
||||
for (int i = 0; i < 100000; ++i) {
|
||||
final String string = strings.get(i);
|
||||
myMap.put(string, string);
|
||||
|
||||
@@ -17,7 +17,7 @@ package com.intellij.util.io;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.IntObjectCache;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -163,7 +163,7 @@ public class StringEnumeratorTest extends TestCase {
|
||||
}
|
||||
};
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("PersistentStringEnumerator.enumerate", () -> {
|
||||
Benchmark.newBenchmark("PersistentStringEnumerator.enumerate", () -> {
|
||||
stringCache.addDeletedPairsListener(listener);
|
||||
for (int i = 0; i < 100000; ++i) {
|
||||
final String string = createRandomString();
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.openapi.util.Disposer
|
||||
import com.intellij.openapi.util.Ref
|
||||
import com.intellij.openapi.util.use
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.createSimpleMessageBusOwner
|
||||
import com.intellij.util.concurrency.AppExecutorUtil
|
||||
import com.intellij.util.messages.ListenerDescriptor
|
||||
@@ -244,7 +244,7 @@ class MessageBusTest : MessageBusOwner {
|
||||
|
||||
@Test
|
||||
fun manyChildrenCreationDeletionPerformance() {
|
||||
PerformanceTestUtil.newPerformanceTest("Child bus creation/deletion") {
|
||||
Benchmark.newBenchmark("Child bus creation/deletion") {
|
||||
val children = ArrayList<MessageBus>()
|
||||
val count = 10000
|
||||
for (i in 0 until count) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import jetbrains.buildServer.messages.serviceMessages.ServiceMessage;
|
||||
import org.hamcrest.core.IsCollectionContaining;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -369,7 +369,7 @@ public class OutputEventSplitterTest extends LightPlatformTestCase {
|
||||
}
|
||||
|
||||
public void testPerformanceWithLotsOfFragments() {
|
||||
PerformanceTestUtil.newPerformanceTest("Flushing lot's of fragments", mySplitter::flush)
|
||||
Benchmark.newBenchmark("Flushing lot's of fragments", mySplitter::flush)
|
||||
.setup(() -> {
|
||||
for (int i = 0; i < 10_000; i++) {
|
||||
mySplitter.process("some string without slash n appending in raw, attempt: " + i + "; ", ProcessOutputTypes.STDOUT);
|
||||
@@ -386,7 +386,7 @@ public class OutputEventSplitterTest extends LightPlatformTestCase {
|
||||
|
||||
}
|
||||
};
|
||||
PerformanceTestUtil.newPerformanceTest("print newlines with backspace", () -> {
|
||||
Benchmark.newBenchmark("print newlines with backspace", () -> {
|
||||
for (int i = 0; i < 2_000_000; i++) {
|
||||
mySplitter.process("some string without slash n appending in raw, attempt: " + i + "; ", ProcessOutputTypes.STDOUT);
|
||||
mySplitter.process(testStarted, ProcessOutputTypes.STDOUT);
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.CommonClassNames;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -2080,16 +2080,16 @@ public class StructuralReplaceTest extends StructuralReplaceTestCase {
|
||||
final String pattern = loadFile("ReformatAndShortenClassRefPerformance_pattern.java");
|
||||
final String replacement = loadFile("ReformatAndShortenClassRefPerformance_replacement.java");
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("SSR Reformat",
|
||||
() -> assertEquals("Reformat Performance", loadFile("ReformatPerformance_result.java"),
|
||||
Benchmark.newBenchmark("SSR Reformat",
|
||||
() -> assertEquals("Reformat Performance", loadFile("ReformatPerformance_result.java"),
|
||||
replace(source, pattern, replacement, true, true)))
|
||||
.startAsSubtest();
|
||||
|
||||
options.setToReformatAccordingToStyle(false);
|
||||
options.setToShortenFQN(true);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("SSR Shorten Class Reference",
|
||||
() -> assertEquals("Shorten Class Ref Performance", loadFile("ShortenPerformance_result.java"),
|
||||
Benchmark.newBenchmark("SSR Shorten Class Reference",
|
||||
() -> assertEquals("Shorten Class Ref Performance", loadFile("ShortenPerformance_result.java"),
|
||||
replace(source, pattern, replacement, true, true)))
|
||||
.startAsSubtest();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.structuralsearch.MatchOptions;
|
||||
import com.intellij.structuralsearch.plugin.ui.SearchConfiguration;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.PairProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -83,8 +83,8 @@ public class SSBasedInspectionTest extends SSBasedInspectionTestCase {
|
||||
final ToolsImpl tools = profile.getToolsOrNull("SSBasedInspection", myFixture.getProject());
|
||||
final SSBasedInspection inspection = (SSBasedInspection)tools.getTool().getTool();
|
||||
final PsiFile file = myFixture.getFile();
|
||||
PerformanceTestUtil.newPerformanceTest("Chained method call inspection performance",
|
||||
() -> InspectionEngine.inspectEx(
|
||||
Benchmark.newBenchmark("Chained method call inspection performance",
|
||||
() -> InspectionEngine.inspectEx(
|
||||
Collections.singletonList(new LocalInspectionToolWrapper(inspection)), file,
|
||||
file.getTextRange(),
|
||||
file.getTextRange(), true, false, true, new DaemonProgressIndicator(), PairProcessor.alwaysTrue())).start();
|
||||
|
||||
@@ -10,21 +10,21 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public interface PerformanceTestInfo {
|
||||
public interface BenchmarkTestInfo {
|
||||
// to warn about not calling .start() in the end
|
||||
@Contract(pure = true)
|
||||
PerformanceTestInfo setup(@NotNull ThrowableRunnable<?> setup);
|
||||
BenchmarkTestInfo setup(@NotNull ThrowableRunnable<?> setup);
|
||||
|
||||
// to warn about not calling .start() in the end
|
||||
@Contract(pure = true)
|
||||
PerformanceTestInfo attempts(int attempts);
|
||||
BenchmarkTestInfo attempts(int attempts);
|
||||
|
||||
/**
|
||||
* Runs the perf test {@code iterations} times before starting the final measuring.
|
||||
*/
|
||||
// to warn about not calling .start() in the end
|
||||
@Contract(pure = true)
|
||||
PerformanceTestInfo warmupIterations(int iterations);
|
||||
BenchmarkTestInfo warmupIterations(int iterations);
|
||||
|
||||
String getUniqueTestName();
|
||||
|
||||
@@ -99,5 +99,5 @@ public interface PerformanceTestInfo {
|
||||
* The method should be invoked right after constructor to provide required data.
|
||||
* It can be part of the constructor since instances are created via ServiceLoader.
|
||||
*/
|
||||
PerformanceTestInfo initialize(@NotNull ThrowableComputable<Integer, ?> test, int expectedInputSize, @NotNull String launchName);
|
||||
BenchmarkTestInfo initialize(@NotNull ThrowableComputable<Integer, ?> test, int expectedInputSize, @NotNull String launchName);
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
package com.intellij.testFramework
|
||||
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import java.util.ServiceConfigurationError
|
||||
import java.util.ServiceLoader
|
||||
import java.util.*
|
||||
|
||||
class PerformanceTestInfoLoader {
|
||||
class BenchmarkTestInfoLoader {
|
||||
companion object {
|
||||
val instance: PerformanceTestInfo
|
||||
val instance: BenchmarkTestInfo
|
||||
get() {
|
||||
val log = logger<PerformanceTestInfo>()
|
||||
val log = logger<BenchmarkTestInfo>()
|
||||
|
||||
val instance = run {
|
||||
val aClass = PerformanceTestInfo::class.java
|
||||
val aClass = BenchmarkTestInfo::class.java
|
||||
val implementations = ServiceLoader.load(aClass, aClass.classLoader).toList()
|
||||
if (implementations.isEmpty()) {
|
||||
throw ServiceConfigurationError("No implementations of ${aClass.name} found. Make sure to include intellij.tools.ide.metrics.benchmark module" +
|
||||
@@ -26,7 +25,7 @@ class PerformanceTestInfoLoader {
|
||||
}
|
||||
}
|
||||
|
||||
log.info("Loaded PerformanceTestInfo implementation ${instance::class.java.name}")
|
||||
log.info("Loaded BenchmarkTestInfo implementation ${instance::class.java.name}")
|
||||
return instance
|
||||
}
|
||||
}
|
||||
@@ -642,16 +642,16 @@ public final class PlatformTestUtil {
|
||||
|
||||
/**
|
||||
* Init a performance test.<br/>
|
||||
* E.g: {@code newPerformanceTest("calculating pi", () -> { CODE_TO_BE_MEASURED_IS_HERE }).start();}
|
||||
* E.g: {@code newBenchmark("calculating pi", () -> { CODE_TO_BE_MEASURED_IS_HERE }).start();}
|
||||
* If you need to customize published metrics, use
|
||||
* {@code com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil#newPerformanceTest} and
|
||||
* {@code com.intellij.tools.ide.metrics.benchmark.Benchmark#newBenchmark} and
|
||||
* method {@code PerformanceTestInfoImpl#withMetricsCollector}.
|
||||
* @see PerformanceTestInfo#start()
|
||||
* @see BenchmarkTestInfo#start()
|
||||
*/
|
||||
// to warn about not calling .assertTiming() in the end
|
||||
@Contract(pure = true)
|
||||
public static @NotNull PerformanceTestInfo newPerformanceTest(@NonNls @NotNull String launchName, @NotNull ThrowableRunnable<?> test) {
|
||||
return newPerformanceTestWithVariableInputSize(launchName, 1, () -> {
|
||||
public static @NotNull BenchmarkTestInfo newBenchmark(@NonNls @NotNull String launchName, @NotNull ThrowableRunnable<?> test) {
|
||||
return newBenchmarkWithVariableInputSize(launchName, 1, () -> {
|
||||
test.run();
|
||||
return 1;
|
||||
});
|
||||
@@ -664,14 +664,14 @@ public final class PlatformTestUtil {
|
||||
* @param expectedInputSize specifies size of the input,
|
||||
* @param test returns actual size of the input. It is supposed that the execution time is lineally proportionally dependent on the input size.
|
||||
*
|
||||
* @see PerformanceTestInfo#start()
|
||||
* @see BenchmarkTestInfo#start()
|
||||
* </p>
|
||||
*/
|
||||
@Contract(pure = true)
|
||||
public static @NotNull PerformanceTestInfo newPerformanceTestWithVariableInputSize(@NonNls @NotNull String launchName,
|
||||
int expectedInputSize,
|
||||
@NotNull ThrowableComputable<Integer, ?> test) {
|
||||
return PerformanceTestInfoLoader.Companion.getInstance().initialize(test, expectedInputSize, launchName);
|
||||
public static @NotNull BenchmarkTestInfo newBenchmarkWithVariableInputSize(@NonNls @NotNull String launchName,
|
||||
int expectedInputSize,
|
||||
@NotNull ThrowableComputable<Integer, ?> test) {
|
||||
return BenchmarkTestInfoLoader.Companion.getInstance().initialize(test, expectedInputSize, launchName);
|
||||
}
|
||||
|
||||
public static void assertPathsEqual(@Nullable String expected, @Nullable String actual) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.openapi.diagnostic.DefaultLogger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.LeakHunter;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
@@ -673,7 +673,7 @@ public class DisposerTest {
|
||||
Disposable root = Disposer.newDisposable("test_root");
|
||||
|
||||
Disposable[] children = IntStream.range(0, N).mapToObj(i -> Disposer.newDisposable("child " + i)).toArray(Disposable[]::new);
|
||||
PerformanceTestUtil.newPerformanceTest(name.getMethodName(), () -> {
|
||||
Benchmark.newBenchmark(name.getMethodName(), () -> {
|
||||
for (Disposable child : children) {
|
||||
Disposer.register(root, child);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.util.text;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
|
||||
public class ImmutableTextTest extends UsefulTestCase {
|
||||
@@ -23,7 +23,7 @@ public class ImmutableTextTest extends UsefulTestCase {
|
||||
public void testDeleteAllPerformance() {
|
||||
ImmutableText original = ImmutableText.valueOf(StringUtil.repeat("abcdefghij", 1_900_000));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Deletion of all contents must be fast", () -> {
|
||||
Benchmark.newBenchmark("Deletion of all contents must be fast", () -> {
|
||||
for (int iter = 0; iter < 100000; iter++) {
|
||||
ImmutableText another = original.delete(0, original.length());
|
||||
assertEquals(0, another.length());
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.LocalFilePath;
|
||||
import com.intellij.testFramework.PlatformTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import junit.framework.TestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -276,21 +276,21 @@ public class HierarchicalFilePathComparatorTest extends TestCase {
|
||||
|
||||
public void testNaturalPerformance() {
|
||||
List<FilePath> filePaths = generatePerformanceTestFilePaths();
|
||||
PerformanceTestUtil.newPerformanceTest("Natural hierarchical comparator", () -> {
|
||||
Benchmark.newBenchmark("Natural hierarchical comparator", () -> {
|
||||
assertComparisonContractNotViolated(filePaths, HierarchicalFilePathComparator.NATURAL);
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void testCaseInsensitivePerformance() {
|
||||
List<FilePath> filePaths = generatePerformanceTestFilePaths();
|
||||
PerformanceTestUtil.newPerformanceTest("Case-insensitive hierarchical comparator", () -> {
|
||||
Benchmark.newBenchmark("Case-insensitive hierarchical comparator", () -> {
|
||||
assertComparisonContractNotViolated(filePaths, HierarchicalFilePathComparator.CASE_INSENSITIVE);
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void testCaseSensitivePerformance() {
|
||||
List<FilePath> filePaths = generatePerformanceTestFilePaths();
|
||||
PerformanceTestUtil.newPerformanceTest("Case-sensitive hierarchical comparator", () -> {
|
||||
Benchmark.newBenchmark("Case-sensitive hierarchical comparator", () -> {
|
||||
assertComparisonContractNotViolated(filePaths, HierarchicalFilePathComparator.CASE_SENSITIVE);
|
||||
}).start();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.testFramework.HeavyPlatformTestCase
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.TestLoggerFactory
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.util.concurrency.ThreadingAssertions
|
||||
import com.intellij.vcsUtil.VcsUtil
|
||||
import java.io.File
|
||||
@@ -340,7 +340,7 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() {
|
||||
"$rootPath/parent/non_existent/some/path"
|
||||
).map { it.filePath }
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("NewMappings few roots FilePaths") {
|
||||
Benchmark.newBenchmark("NewMappings few roots FilePaths") {
|
||||
for (i in 0..20000) {
|
||||
for (filePath in toCheck) {
|
||||
mappings.getMappedRootFor(filePath)
|
||||
@@ -363,7 +363,7 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() {
|
||||
"$rootPath/non_existent/some/path"
|
||||
).map { it.filePath }
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("NewMappings many roots FilePaths") {
|
||||
Benchmark.newBenchmark("NewMappings many roots FilePaths") {
|
||||
for (i in 0..20000) {
|
||||
for (filePath in toCheck) {
|
||||
mappings.getMappedRootFor(filePath)
|
||||
@@ -390,7 +390,7 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() {
|
||||
"$rootPath/parent/" + "dir/".repeat(220)
|
||||
).map { it.filePath }
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("NewMappings nested roots FilePaths") {
|
||||
Benchmark.newBenchmark("NewMappings nested roots FilePaths") {
|
||||
for (i in 0..2000) {
|
||||
for (filePath in toCheck) {
|
||||
mappings.getMappedRootFor(filePath)
|
||||
@@ -414,7 +414,7 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() {
|
||||
"$rootPath/parent/non_existent/some/path"
|
||||
))
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("NewMappings few roots VirtualFiles") {
|
||||
Benchmark.newBenchmark("NewMappings few roots VirtualFiles") {
|
||||
for (i in 0..60000) {
|
||||
for (filePath in toCheck) {
|
||||
mappings.getMappedRootFor(filePath)
|
||||
@@ -437,7 +437,7 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() {
|
||||
"$rootPath/non_existent/some/path"
|
||||
))
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("NewMappings many roots VirtualFiles") {
|
||||
Benchmark.newBenchmark("NewMappings many roots VirtualFiles") {
|
||||
for (i in 0..80000) {
|
||||
for (filePath in toCheck) {
|
||||
mappings.getMappedRootFor(filePath)
|
||||
@@ -464,7 +464,7 @@ class DirectoryMappingListTest : HeavyPlatformTestCase() {
|
||||
"$rootPath/parent/" + "dir/".repeat(200)
|
||||
))
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("NewMappings nested roots VirtualFiles") {
|
||||
Benchmark.newBenchmark("NewMappings nested roots VirtualFiles") {
|
||||
for (i in 0..15000) {
|
||||
for (filePath in toCheck) {
|
||||
mappings.getMappedRootFor(filePath)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package com.intellij.openapi.vcs
|
||||
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
|
||||
class LineStatusTrackerModifyPerformanceTest : BaseLineStatusTrackerTestCase() {
|
||||
fun testInitialUnfreeze() {
|
||||
@@ -17,7 +17,7 @@ class LineStatusTrackerModifyPerformanceTest : BaseLineStatusTrackerTestCase() {
|
||||
val text1 = sb1.toString()
|
||||
val text2 = sb2.toString()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(PlatformTestUtil.getTestName(name, true)) {
|
||||
Benchmark.newBenchmark(PlatformTestUtil.getTestName(name, true)) {
|
||||
test(text1) {
|
||||
tracker.doFrozen(Runnable {
|
||||
simpleTracker.setBaseRevision(text2)
|
||||
@@ -42,7 +42,7 @@ class LineStatusTrackerModifyPerformanceTest : BaseLineStatusTrackerTestCase() {
|
||||
val text2 = sb2.toString()
|
||||
val text3 = sb3.toString()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(PlatformTestUtil.getTestName(name, true)) {
|
||||
Benchmark.newBenchmark(PlatformTestUtil.getTestName(name, true)) {
|
||||
test(text1, text2) {
|
||||
tracker.doFrozen(Runnable {
|
||||
simpleTracker.setBaseRevision(text3)
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.intellij.testFramework.junit5.TestApplication
|
||||
import com.intellij.testFramework.rules.ProjectModelExtension
|
||||
import com.intellij.testFramework.utils.io.createDirectory
|
||||
import com.intellij.testFramework.workspaceModel.updateProjectModel
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.workspaceModel.ide.impl.IdeVirtualFileUrlManagerImpl
|
||||
import com.intellij.workspaceModel.ide.impl.WorkspaceModelCacheSerializer.PluginAwareEntityTypesResolver
|
||||
import com.intellij.workspaceModel.ide.impl.jps.serialization.CachingJpsFileContentReader
|
||||
@@ -95,7 +95,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var storage = MutableEntityStorage.create().toSnapshot()
|
||||
val times = 20_000
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
repeat(times) {
|
||||
val builder = storage.toBuilder()
|
||||
|
||||
@@ -119,7 +119,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
val times = 2_000_000
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
repeat(times) {
|
||||
val entity = storage.entities(NamedEntity::class.java).single()
|
||||
blackhole(entity)
|
||||
@@ -139,7 +139,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val times = 2_000_000
|
||||
val parents = ArrayList<NamedEntity>(times)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Named entities adding") {
|
||||
Benchmark.newBenchmark("Named entities adding") {
|
||||
repeat(times) {
|
||||
parents += builder addEntity NamedEntity("$it", MySource)
|
||||
}
|
||||
@@ -147,7 +147,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
.warmupIterations(0)
|
||||
.attempts(1).startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Soft linked entities adding") {
|
||||
Benchmark.newBenchmark("Soft linked entities adding") {
|
||||
for (parent in parents) {
|
||||
builder addEntity ComposedIdSoftRefEntity("-${parent.myName}", parent.symbolicId, MySource)
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val storage = builder.toSnapshot()
|
||||
val newBuilder = storage.toBuilder()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
repeat(size) {
|
||||
val value = newBuilder.resolve(NameId("$it"))!!
|
||||
newBuilder.modifyNamedEntity(value) {
|
||||
@@ -193,7 +193,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val storage = builder.toSnapshot()
|
||||
val list = mutableListOf<ComposedIdSoftRefEntity>()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
repeat(size) {
|
||||
list.addAll(storage.referrers(NameId("$it"), ComposedIdSoftRefEntity::class.java).toList())
|
||||
}
|
||||
@@ -218,7 +218,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
val file = Files.createTempFile("tmpModel", "")
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - Serialization") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - Serialization") {
|
||||
repeat(200) {
|
||||
serializer.serializeCache(file, storage)
|
||||
}
|
||||
@@ -226,7 +226,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
.warmupIterations(0)
|
||||
.attempts(1).startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - Deserialization") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - Deserialization") {
|
||||
repeat(200) {
|
||||
sizes += Files.size(file).toInt()
|
||||
serializer.deserializeCache(file).getOrThrow()
|
||||
@@ -235,7 +235,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
.warmupIterations(0)
|
||||
.attempts(1).startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - SerializationFromFile") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - SerializationFromFile") {
|
||||
repeat(200) {
|
||||
serializer.serializeCache(file, storage)
|
||||
}
|
||||
@@ -243,7 +243,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
.warmupIterations(0)
|
||||
.attempts(1).startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - DeserializationFromFile") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - DeserializationFromFile") {
|
||||
repeat(200) {
|
||||
serializer.deserializeCache(file).getOrThrow()
|
||||
}
|
||||
@@ -279,7 +279,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
})
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
storageBuilder.replaceBySource({ true }, replaceStorage)
|
||||
}
|
||||
.warmupIterations(0)
|
||||
@@ -288,7 +288,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `project model updates`(testInfo: TestInfo) {
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
runWriteActionAndWait {
|
||||
measureTimeMillis {
|
||||
repeat(10_000) {
|
||||
@@ -308,7 +308,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val manager = WorkspaceModel.getInstance(projectModel.project).getVirtualFileUrlManager()
|
||||
val newFolder = tempFolder.newRandomDirectory()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
runWriteActionAndWait {
|
||||
measureTimeMillis {
|
||||
EntitiesOrphanage.getInstance(projectModel.project).update {
|
||||
@@ -344,7 +344,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val newFolder = VfsUtilCore.pathToUrl(tempFolder.newRandomDirectory().toString())
|
||||
val manager = WorkspaceModel.getInstance(projectModel.project).getVirtualFileUrlManager()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
runWriteActionAndWait {
|
||||
measureTimeMillis {
|
||||
EntitiesOrphanage.getInstance(projectModel.project).update {
|
||||
@@ -391,7 +391,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val newFolder = tempFolder.newRandomDirectory()
|
||||
val manager = WorkspaceModel.getInstance(projectModel.project).getVirtualFileUrlManager()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
runWriteActionAndWait {
|
||||
measureTimeMillis {
|
||||
EntitiesOrphanage.getInstance(projectModel.project).update {
|
||||
@@ -434,7 +434,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `update storage via replaceProjectModel`(testInfo: TestInfo) {
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
runWriteActionAndWait {
|
||||
repeat(1000) {
|
||||
val builderSnapshot = (WorkspaceModel.getInstance(projectModel.project) as WorkspaceModelInternal).getBuilderSnapshot()
|
||||
@@ -505,7 +505,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
} as MutableEntityStorageInstrumentation
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
builders.forEach { it.collectChanges() }
|
||||
}
|
||||
.warmupIterations(0)
|
||||
@@ -555,7 +555,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
builders.zip(newBuilders).forEach { (initial, update) ->
|
||||
initial.applyChangesFrom(update)
|
||||
}
|
||||
@@ -586,7 +586,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
builder.toSnapshot().toBuilder()
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
builders.forEach { builder ->
|
||||
// Populate builder with changes
|
||||
repeat(1000) {
|
||||
@@ -642,7 +642,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
val childData = entities<ParentMultipleEntity>().flatMap { parentEntity, _ -> parentEntity.children }.map { it.childData }
|
||||
|
||||
// Do first request
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - First Access") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - First Access") {
|
||||
snapshots.forEach { snapshot ->
|
||||
snapshot.cached(namesOfNamedEntities)
|
||||
snapshot.cached(sourcesByName)
|
||||
@@ -653,7 +653,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
.attempts(1).startAsSubtest()
|
||||
|
||||
// Do second request without any modifications
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - Second Access - No Changes") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - Second Access - No Changes") {
|
||||
snapshots.forEach { snapshot ->
|
||||
snapshot.cached(namesOfNamedEntities)
|
||||
snapshot.cached(sourcesByName)
|
||||
@@ -692,7 +692,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println("Start third read...")
|
||||
// Do request after modifications
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - Third Access - After Modification") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - Third Access - After Modification") {
|
||||
newSnapshots.forEach { snapshot ->
|
||||
snapshot.cached(namesOfNamedEntities)
|
||||
snapshot.cached(sourcesByName)
|
||||
@@ -732,7 +732,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
Assertions.assertFalse(CacheResetTracker.cacheReset)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - Fourth Access - After Second Modification") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - Fourth Access - After Second Modification") {
|
||||
snapshotsWithLotOfUpdates.forEach { snapshot ->
|
||||
snapshot.cached(namesOfNamedEntities)
|
||||
snapshot.cached(sourcesByName)
|
||||
@@ -760,7 +760,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
Assertions.assertTrue(CacheResetTracker.cacheReset)
|
||||
|
||||
println("Read fourth time")
|
||||
PerformanceTestUtil.newPerformanceTest("${testInfo.displayName} - Fifth Access - After a Lot of Modifications") {
|
||||
Benchmark.newBenchmark("${testInfo.displayName} - Fifth Access - After a Lot of Modifications") {
|
||||
snapshotsWithTonsOfUpdates.forEach { snapshot ->
|
||||
snapshot.cached(namesOfNamedEntities)
|
||||
snapshot.cached(sourcesByName)
|
||||
@@ -818,7 +818,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
var mySnapshot = builder.toSnapshot()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
repeat(size) {
|
||||
val myBuilder = mySnapshot.toBuilder()
|
||||
val entity = myBuilder.resolve(NameId("Name$it"))!!
|
||||
@@ -843,7 +843,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var snapshot = builder.toSnapshot()
|
||||
|
||||
println("Test one --- Raw recalculate")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + " raw calculate - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + " raw calculate - size: $size") {
|
||||
val time = measureTime {
|
||||
snapshot.entities<NamedEntity>().map { it.myName }.toList()
|
||||
}
|
||||
@@ -854,7 +854,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test two --- First calculate")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- first calculate - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- first calculate - size: $size") {
|
||||
val time2 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -865,7 +865,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test three --- Unmodified second access")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- second access - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- second access - size: $size") {
|
||||
val time3 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -878,7 +878,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test four --- Add one entity")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- Add one entity - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- Add one entity - size: $size") {
|
||||
val time4 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -906,7 +906,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test five --- Update 10% of entities")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- Affect 10% of entities - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- Affect 10% of entities - size: $size") {
|
||||
val time5 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -936,7 +936,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var snapshot = builder.toSnapshot()
|
||||
|
||||
println("Test one --- Raw recalculate")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + " raw calculate - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + " raw calculate - size: $size") {
|
||||
val time = measureTime {
|
||||
snapshot.entities<NamedEntity>()
|
||||
.flatMap { it.children }
|
||||
@@ -951,7 +951,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test two --- First calculate")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- first calculate - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- first calculate - size: $size") {
|
||||
val time2 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -962,7 +962,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test three --- Unmodified second access")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- second access - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- second access - size: $size") {
|
||||
val time3 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -979,7 +979,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test four --- Add one entity")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- Add one entity - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- Add one entity - size: $size") {
|
||||
val time4 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -1014,7 +1014,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
|
||||
println()
|
||||
println("Test five --- Update 10% of entities")
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + "- Affect 10% of entities - size: $size") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + "- Affect 10% of entities - size: $size") {
|
||||
val time51 = measureTime {
|
||||
snapshot.cached(q)
|
||||
}
|
||||
@@ -1126,7 +1126,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
fun `get for kotlin persistent map`(size: Int) {
|
||||
val requestSize = 10_000_000
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(size.toString()) {
|
||||
Benchmark.newBenchmark(size.toString()) {
|
||||
testPersistentMap(size, requestSize)
|
||||
}
|
||||
.warmupIterations(0)
|
||||
@@ -1166,7 +1166,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var cache = cache()
|
||||
cache.cached(q, snapshot, null)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Cache - adding 1000 modules") {
|
||||
Benchmark.newBenchmark("Cache - adding 1000 modules") {
|
||||
repeat(1000) { count ->
|
||||
val newBuilder = snapshot.toBuilder().also { it addEntity NamedEntity("AnotherData$count", MySource) }
|
||||
val newCache = cache()
|
||||
@@ -1198,7 +1198,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var cache = cache()
|
||||
cache.cached(q, snapshot, null)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Cache - removing 1000 modules") {
|
||||
Benchmark.newBenchmark("Cache - removing 1000 modules") {
|
||||
repeat(1000) { count ->
|
||||
val newBuilder = snapshot.toBuilder().also {
|
||||
val id = it.resolve(NameId("Another$count"))!!
|
||||
@@ -1233,7 +1233,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var cache = cache()
|
||||
cache.cached(q, snapshot, null)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Cache - modifying 1000 modules") {
|
||||
Benchmark.newBenchmark("Cache - modifying 1000 modules") {
|
||||
repeat(1000) { count ->
|
||||
val newBuilder = snapshot.toBuilder().also {
|
||||
val id = it.resolve(NameId("Another$count"))!!
|
||||
@@ -1270,7 +1270,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var cache = cache()
|
||||
cache.cached(q, snapshot, null)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Cache - unrelated modifications 1000 times") {
|
||||
Benchmark.newBenchmark("Cache - unrelated modifications 1000 times") {
|
||||
repeat(1000) { count ->
|
||||
val newBuilder = snapshot.toBuilder().also { builder ->
|
||||
if (count % 2 == 0) {
|
||||
@@ -1305,7 +1305,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var cache = cache()
|
||||
cache.cached(q, snapshot, null)
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Cache - related modifications 1000 times") {
|
||||
Benchmark.newBenchmark("Cache - related modifications 1000 times") {
|
||||
repeat(1000) { count ->
|
||||
val newBuilder = snapshot.toBuilder().also { builder ->
|
||||
if (count % 2 == 0) {
|
||||
@@ -1340,7 +1340,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
var cache = cache()
|
||||
qs.forEach { q -> cache.cached(q, snapshot, null) }
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Cache - many queries and related modifications 1000 times") {
|
||||
Benchmark.newBenchmark("Cache - many queries and related modifications 1000 times") {
|
||||
repeat(1000) { count ->
|
||||
val newBuilder = snapshot.toBuilder().also { builder ->
|
||||
if (count % 2 == 0) {
|
||||
@@ -1381,7 +1381,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
this.children = emptyList()
|
||||
}
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName) {
|
||||
Benchmark.newBenchmark(testInfo.displayName) {
|
||||
builder.entities<ParentMultipleEntity>().forEach { parent ->
|
||||
builder.modifyParentMultipleEntity(parent) {
|
||||
this.children += List(10) { ChildMultipleEntity("Child_2_$it", MySource) }
|
||||
@@ -1391,7 +1391,7 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
.warmupIterations(0)
|
||||
.attempts(1).start()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(testInfo.displayName + " - applyChangesFrom") {
|
||||
Benchmark.newBenchmark(testInfo.displayName + " - applyChangesFrom") {
|
||||
initialSnapshot.toBuilder().applyChangesFrom(builder)
|
||||
}
|
||||
.warmupIterations(0)
|
||||
@@ -1401,13 +1401,13 @@ class WorkspaceModelBenchmarksPerformanceTest {
|
||||
private fun measureOperation(launchName: String, singleBuilderEntities: List<Pair<MutableEntityStorage, NamedEntity>>,
|
||||
perBuilderEntities: List<Pair<MutableEntityStorage, NamedEntity>>,
|
||||
operation: (Int, Pair<MutableEntityStorage, NamedEntity>) -> Unit): Unit {
|
||||
PerformanceTestUtil.newPerformanceTest("$launchName-singleBuilderEntities") {
|
||||
Benchmark.newBenchmark("$launchName-singleBuilderEntities") {
|
||||
singleBuilderEntities.forEachIndexed(operation)
|
||||
}
|
||||
.warmupIterations(0)
|
||||
.attempts(1).startAsSubtest()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("$launchName-perBuilderEntities") {
|
||||
Benchmark.newBenchmark("$launchName-perBuilderEntities") {
|
||||
perBuilderEntities.forEachIndexed(operation)
|
||||
}
|
||||
.warmupIterations(0)
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.intellij.platform.backend.workspace.toVirtualFileUrl
|
||||
import com.intellij.platform.workspace.jps.entities.*
|
||||
import com.intellij.platform.workspace.storage.MutableEntityStorage
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrl
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.testFramework.junit5.RunInEdt
|
||||
import com.intellij.testFramework.junit5.TestApplication
|
||||
@@ -100,7 +100,7 @@ class WorkspaceModelPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `add remove module`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Adding and removing a module 10 times") {
|
||||
Benchmark.newBenchmark("Adding and removing a module 10 times") {
|
||||
repeat(10) {
|
||||
val module = ourProjectModel.createModule("newModule")
|
||||
ourProjectModel.removeModule(module)
|
||||
@@ -110,7 +110,7 @@ class WorkspaceModelPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `add remove project library`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Adding and removing a project library 30 times") {
|
||||
Benchmark.newBenchmark("Adding and removing a project library 30 times") {
|
||||
repeat(30) {
|
||||
val library = ourProjectModel.addProjectLevelLibrary("newLibrary") {
|
||||
it.addRoot(ourProjectRoot.append("newLibrary/classes").url, OrderRootType.CLASSES)
|
||||
@@ -125,7 +125,7 @@ class WorkspaceModelPerformanceTest {
|
||||
@Test
|
||||
fun `add remove module library`() {
|
||||
val module = ourProjectModel.moduleManager.findModuleByName("module50")!!
|
||||
PerformanceTestUtil.newPerformanceTest("Adding and removing a module library 10 times") {
|
||||
Benchmark.newBenchmark("Adding and removing a module library 10 times") {
|
||||
repeat(10) {
|
||||
val library = ourProjectModel.addModuleLevelLibrary(module, "newLibrary") {
|
||||
it.addRoot(ourProjectRoot.append("newLibrary/classes").url, OrderRootType.CLASSES)
|
||||
@@ -141,7 +141,7 @@ class WorkspaceModelPerformanceTest {
|
||||
fun `add remove dependency`() {
|
||||
val module = ourProjectModel.moduleManager.findModuleByName("module50")!!
|
||||
val library = ourProjectModel.projectLibraryTable.getLibraryByName("lib40")!!
|
||||
PerformanceTestUtil.newPerformanceTest("Adding and removing a dependency 20 times") {
|
||||
Benchmark.newBenchmark("Adding and removing a dependency 20 times") {
|
||||
repeat(20) {
|
||||
ModuleRootModificationUtil.addDependency(module, library)
|
||||
ModuleRootModificationUtil.removeDependency(module, library)
|
||||
@@ -151,7 +151,7 @@ class WorkspaceModelPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `process content roots`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Iterate through content roots of all modules 1000 times") {
|
||||
Benchmark.newBenchmark("Iterate through content roots of all modules 1000 times") {
|
||||
var count = 0
|
||||
repeat(1000) {
|
||||
ourProjectModel.moduleManager.modules.forEach { module ->
|
||||
@@ -164,7 +164,7 @@ class WorkspaceModelPerformanceTest {
|
||||
|
||||
@Test
|
||||
fun `process order entries`() {
|
||||
PerformanceTestUtil.newPerformanceTest("Iterate through order entries of all modules 1000 times") {
|
||||
Benchmark.newBenchmark("Iterate through order entries of all modules 1000 times") {
|
||||
var count = 0
|
||||
repeat(1000) {
|
||||
ourProjectModel.moduleManager.modules.forEach { module ->
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.intellij.codeInsight.daemon.impl.HighlightInfo;
|
||||
import com.intellij.idea.HardwareAgentRequired;
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.testFramework.ExpectedHighlightingData;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -25,7 +25,7 @@ public class AntHighlightingPerformanceTest extends DaemonAnalyzerTestCase {
|
||||
findVirtualFile(getTestName(false) + ".xml"),
|
||||
findVirtualFile("buildserver.xml"),
|
||||
findVirtualFile("buildserver.properties"));
|
||||
PerformanceTestUtil.newPerformanceTest("Big ant file highlighting", () -> doDoTest(true, false))
|
||||
Benchmark.newBenchmark("Big ant file highlighting", () -> doDoTest(true, false))
|
||||
.setup(getPsiManager()::dropPsiCaches)
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.jetbrains.idea.devkit.util;
|
||||
|
||||
import com.intellij.execution.console.CustomizableConsoleFoldingBean;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.SkipSlowTestLocally;
|
||||
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
||||
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
|
||||
@@ -30,7 +30,7 @@ public class ExtensionLocatorPerformanceTest extends JavaCodeInsightFixtureTestC
|
||||
myFixture.configureByText("plugin.xml", generatePluginXmlText(randomMethodNames));
|
||||
PsiClass psiClass = myFixture.addClass(generateJavaClassText(randomMethodNames));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("Locating extension tag by PsiClass", () -> {
|
||||
Benchmark.newBenchmark("Locating extension tag by PsiClass", () -> {
|
||||
List<ExtensionCandidate> result = locateExtensionsByPsiClass(psiClass);
|
||||
assertSize(1, result);
|
||||
}).attempts(1).start();
|
||||
|
||||
@@ -4,7 +4,7 @@ package org.editorconfig.language.codeinsight
|
||||
import com.intellij.codeInspection.LocalInspectionTool
|
||||
import com.intellij.lang.annotation.HighlightSeverity
|
||||
import com.intellij.openapi.application.ex.PathManagerEx
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.UsefulTestCase
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase
|
||||
import com.intellij.util.ThrowableRunnable
|
||||
@@ -115,7 +115,7 @@ class EditorConfigInspectionsTest : BasePlatformTestCase() {
|
||||
private fun doTestPerf(inspection: KClass<out LocalInspectionTool>) {
|
||||
myFixture.enableInspections(inspection.java)
|
||||
myFixture.configureByFile("${getTestName(true)}/.editorconfig")
|
||||
PerformanceTestUtil.newPerformanceTest("${inspection.simpleName} performance", ThrowableRunnable<Throwable> {
|
||||
Benchmark.newBenchmark("${inspection.simpleName} performance", ThrowableRunnable<Throwable> {
|
||||
myFixture.doHighlighting()
|
||||
}).attempts(1).start()
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.openapi.editor.ex.DocumentEx
|
||||
import com.intellij.openapi.editor.ex.RangeMarkerEx
|
||||
import com.intellij.openapi.vfs.readText
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.util.asSafely
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.plugins.gradle.testFramework.GradleCodeInsightTestCase
|
||||
@@ -32,7 +32,7 @@ class GradleHighlightingPerformanceTest : GradleCodeInsightTestCase() {
|
||||
fixture.editor.caretModel.moveToOffset(pos + 1)
|
||||
fixture.checkHighlighting()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("GradleHighlightingPerformanceTest.testPerformance") {
|
||||
Benchmark.newBenchmark("GradleHighlightingPerformanceTest.testPerformance") {
|
||||
fixture.psiManager.dropPsiCaches()
|
||||
repeat(4) {
|
||||
fixture.type('a')
|
||||
@@ -60,7 +60,7 @@ class GradleHighlightingPerformanceTest : GradleCodeInsightTestCase() {
|
||||
val document = PsiDocumentManager.getInstance(project).getDocument(fixture.file)
|
||||
disableSlowCompletionElements(fixture.testRootDisposable)
|
||||
val repeatSize = 10
|
||||
PerformanceTestUtil.newPerformanceTest("GradleHighlightingPerformanceTest.testCompletion") {
|
||||
Benchmark.newBenchmark("GradleHighlightingPerformanceTest.testCompletion") {
|
||||
fixture.psiManager.dropResolveCaches()
|
||||
repeat(repeatSize) {
|
||||
val lookupElements = fixture.completeBasic()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package org.jetbrains.plugins.gradle.execution
|
||||
|
||||
import com.intellij.openapi.project.modules
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.useProjectAsync
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.jetbrains.plugins.gradle.execution.build.CachedModuleDataFinder
|
||||
@@ -45,7 +45,7 @@ class GradleModuleDataFinderPerformanceTest : GradleTestCase() {
|
||||
initProject(projectInfo)
|
||||
openProject("project").useProjectAsync { project ->
|
||||
assertProjectStructure(project, projectInfo)
|
||||
PerformanceTestUtil.newPerformanceTest("CachedModuleDataFinderPerformanceTest CachedModuleDataFinder#findModuleData($numModules)") {
|
||||
Benchmark.newBenchmark("CachedModuleDataFinderPerformanceTest CachedModuleDataFinder#findModuleData($numModules)") {
|
||||
for (module in project.modules) {
|
||||
val moduleData = CachedModuleDataFinder.findModuleData(module)!!
|
||||
Assertions.assertEquals(module.name, moduleData.data.internalName)
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.intellij.grazie.ide.language
|
||||
|
||||
import com.intellij.grazie.GrazieTestBase
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class JavaSupportTest : GrazieTestBase() {
|
||||
}
|
||||
|
||||
fun `test long comment performance`() {
|
||||
PerformanceTestUtil.newPerformanceTest("highlighting") {
|
||||
Benchmark.newBenchmark("highlighting") {
|
||||
runHighlightTestForFile("ide/language/java/LongCommentPerformance.java")
|
||||
}.setup { psiManager.dropPsiCaches() }.start()
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class JavaSupportTest : GrazieTestBase() {
|
||||
fun `test performance with many line comments`() {
|
||||
val text = "// this is a single line comment\n".repeat(5000)
|
||||
myFixture.configureByText("a.java", text)
|
||||
PerformanceTestUtil.newPerformanceTest("highlighting") {
|
||||
Benchmark.newBenchmark("highlighting") {
|
||||
myFixture.checkHighlighting()
|
||||
}.setup { psiManager.dropPsiCaches() }.start()
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTag;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import one.util.streamex.IntStreamEx;
|
||||
import org.intellij.lang.regexp.RegExpLanguage;
|
||||
@@ -234,8 +234,8 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
int offset2 = text.indexOf("\n<!ENTITY");
|
||||
PsiFile file = myFixture.configureByText("a.xml", text);
|
||||
|
||||
PerformanceTestUtil
|
||||
.newPerformanceTest("text extraction", () -> {
|
||||
Benchmark
|
||||
.newBenchmark("text extraction", () -> {
|
||||
assertEquals("content", TextExtractor.findTextAt(file, offset1, TextContent.TextDomain.ALL).toString());
|
||||
assertNull(TextExtractor.findTextAt(file, offset2, TextContent.TextDomain.ALL));
|
||||
})
|
||||
@@ -252,8 +252,8 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
" </rules>";
|
||||
PsiFile file = myFixture.configureByText("a.xml", text);
|
||||
|
||||
PerformanceTestUtil
|
||||
.newPerformanceTest("text extraction", () -> {
|
||||
Benchmark
|
||||
.newBenchmark("text extraction", () -> {
|
||||
for (PsiElement element : SyntaxTraverser.psiTraverser(file)) {
|
||||
TextExtractor.findTextsAt(element, TextContent.TextDomain.ALL);
|
||||
}
|
||||
@@ -311,7 +311,7 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
String expected = "b".repeat(10_000);
|
||||
PsiFile file = myFixture.configureByText("a.xml", text);
|
||||
TextContentBuilder builder = TextContentBuilder.FromPsi.excluding(e -> e instanceof XmlTag);
|
||||
PerformanceTestUtil.newPerformanceTest("TextContent building with concatenation", () -> {
|
||||
Benchmark.newBenchmark("TextContent building with concatenation", () -> {
|
||||
assertEquals(expected, builder.build(file, TextContent.TextDomain.PLAIN_TEXT).toString());
|
||||
}).start();
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
PsiFile file = myFixture.configureByText("a.java", "/*\n" + text + "*/");
|
||||
PsiComment comment = assertInstanceOf(file.findElementAt(10), PsiComment.class);
|
||||
TextContentBuilder builder = TextContentBuilder.FromPsi.removingIndents(" ");
|
||||
PerformanceTestUtil.newPerformanceTest("TextContent building with indent removing", () -> {
|
||||
Benchmark.newBenchmark("TextContent building with indent removing", () -> {
|
||||
assertEquals(expected, builder.build(comment, TextContent.TextDomain.COMMENTS).toString());
|
||||
}).start();
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
PsiFile file = myFixture.configureByText("a.java", "/**\n" + text + "*/");
|
||||
PsiDocComment comment = PsiTreeUtil.findElementOfClassAtOffset(file, 10, PsiDocComment.class, false);
|
||||
TextExtractor extractor = new JavaTextExtractor();
|
||||
PerformanceTestUtil.newPerformanceTest("TextContent building with HTML removal", () -> {
|
||||
Benchmark.newBenchmark("TextContent building with HTML removal", () -> {
|
||||
assertEquals(expected, extractor.buildTextContent(comment, TextContent.TextDomain.ALL).toString());
|
||||
}).start();
|
||||
}
|
||||
@@ -344,7 +344,7 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
PsiFile file = myFixture.configureByText("a.md", text);
|
||||
var psi = PsiTreeUtil.findElementOfClassAtOffset(file, 10, MarkdownParagraph.class, false);
|
||||
TextExtractor extractor = new MarkdownTextExtractor();
|
||||
PerformanceTestUtil.newPerformanceTest("TextContent building with nbsp removal", () -> {
|
||||
Benchmark.newBenchmark("TextContent building with nbsp removal", () -> {
|
||||
assertEquals(expected, extractor.buildTextContent(psi, TextContent.TextDomain.ALL).toString());
|
||||
}).start();
|
||||
}
|
||||
@@ -356,7 +356,7 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
PsiFile file = myFixture.configureByText("a.java", "class C { String s = \"\"\"\n" + text + "\"\"\"; }");
|
||||
var literal = PsiTreeUtil.findElementOfClassAtOffset(file, 100, PsiLiteralExpression.class, false);
|
||||
var extractor = new JavaTextExtractor();
|
||||
PerformanceTestUtil.newPerformanceTest("TextContent building from a long text fragment", () -> {
|
||||
Benchmark.newBenchmark("TextContent building from a long text fragment", () -> {
|
||||
assertEquals(expected, extractor.buildTextContent(literal, TextContent.TextDomain.ALL).toString());
|
||||
}).start();
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class TextExtractionTest extends BasePlatformTestCase {
|
||||
PsiFile file = myFixture.configureByText("a.java", text);
|
||||
TextExtractor extractor = new JavaTextExtractor();
|
||||
PsiElement tag = PsiTreeUtil.findElementOfClassAtOffset(file, text.indexOf("something"), PsiDocTag.class, false);
|
||||
PerformanceTestUtil.newPerformanceTest("TextContent building from complex PSI", () -> {
|
||||
Benchmark.newBenchmark("TextContent building from complex PSI", () -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
TextContent content = extractor.buildTextContent(tag, TextContent.TextDomain.ALL);
|
||||
assertEquals("something if is not too expensive", content.toString());
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.util.RecursionManager
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.util.ThrowableRunnable
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.plugins.groovy.GroovyProjectDescriptors
|
||||
@@ -96,7 +96,7 @@ class GroovyStressPerformanceTest extends LightGroovyTestCase {
|
||||
myFixture.type 'foo {}\n'
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), {
|
||||
Benchmark.newBenchmark(getTestName(false), {
|
||||
story.toCharArray().each {
|
||||
myFixture.type it
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments()
|
||||
@@ -116,7 +116,7 @@ class GroovyStressPerformanceTest extends LightGroovyTestCase {
|
||||
}
|
||||
|
||||
private void measureHighlighting(String text) {
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), configureAndHighlight(text)).start()
|
||||
Benchmark.newBenchmark(getTestName(false), configureAndHighlight(text)).start()
|
||||
}
|
||||
|
||||
void testDeeplyNestedClosures() {
|
||||
@@ -253,7 +253,7 @@ class Cl {
|
||||
}
|
||||
}
|
||||
"""
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), configureAndHighlight(text))
|
||||
Benchmark.newBenchmark(getTestName(false), configureAndHighlight(text))
|
||||
.attempts(20)
|
||||
.start()
|
||||
}
|
||||
@@ -274,7 +274,7 @@ while (true) {
|
||||
f.canoPath<caret>
|
||||
}
|
||||
'''
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), configureAndComplete(text)).attempts(1).start()
|
||||
Benchmark.newBenchmark(getTestName(false), configureAndComplete(text)).attempts(1).start()
|
||||
}
|
||||
|
||||
void testClosureRecursion() {
|
||||
@@ -477,7 +477,7 @@ ${(1..classMethodCount).collect({"void foo${it}() {}"}).join("\n")}
|
||||
"}"
|
||||
myFixture.configureByText('a.groovy', '')
|
||||
assert myFixture.file instanceof GroovyFile
|
||||
PerformanceTestUtil.newPerformanceTest('many siblings', {
|
||||
Benchmark.newBenchmark('many siblings', {
|
||||
// clear caches
|
||||
WriteCommandAction.runWriteCommandAction(project) {
|
||||
myFixture.editor.document.text = ""
|
||||
@@ -521,7 +521,7 @@ public class Yoo$i implements Serializable, Cloneable, Hoo$i<String> {}
|
||||
public class Doo$i {}
|
||||
"""
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest("testing dfa", {
|
||||
Benchmark.newBenchmark("testing dfa", {
|
||||
myFixture.checkHighlighting true, false, false
|
||||
}).setup({
|
||||
myFixture.enableInspections GroovyAssignabilityCheckInspection, UnusedDefInspection, GrUnusedIncDecInspection
|
||||
@@ -601,7 +601,7 @@ foo${n}(a) {
|
||||
foo${n - 1}(1)
|
||||
}""")
|
||||
def file = fixture.configureByText('_.groovy', builder.toString()) as GroovyFile
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), {
|
||||
Benchmark.newBenchmark(getTestName(false), {
|
||||
myFixture.psiManager.dropPsiCaches()
|
||||
(file.methods.last().block.statements.last() as GrExpression).type
|
||||
}).attempts(5).start()
|
||||
@@ -609,7 +609,7 @@ foo${n}(a) {
|
||||
|
||||
void 'test complex DFA with a lot of closures'() {
|
||||
fixture.configureByFile("stress/dfa.groovy")
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), {
|
||||
Benchmark.newBenchmark(getTestName(false), {
|
||||
myFixture.psiManager.dropPsiCaches()
|
||||
myFixture.doHighlighting()
|
||||
}).attempts(10).start()
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.htmltools.codeInspection.htmlInspections.HtmlDeprecatedTagIn
|
||||
import com.intellij.htmltools.codeInspection.htmlInspections.HtmlPresentationalElementInspection;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import com.intellij.xml.util.CheckXmlFileWithXercesValidatorInspection;
|
||||
import com.intellij.xml.util.XmlDuplicatedIdInspection;
|
||||
@@ -37,14 +37,14 @@ public class HtmlHighlightingPerformanceTest extends BasePlatformTestCase {
|
||||
|
||||
public void testPerformance2() {
|
||||
myFixture.configureByFiles(getTestName(false) + ".html", "manual.css");
|
||||
PerformanceTestUtil.newPerformanceTest("HTML Highlighting 2", () -> doTest())
|
||||
Benchmark.newBenchmark("HTML Highlighting 2", () -> doTest())
|
||||
.warmupIterations(1)
|
||||
.start();
|
||||
}
|
||||
|
||||
public void testPerformance() {
|
||||
myFixture.configureByFiles(getTestName(false) + ".html", "stylesheet.css");
|
||||
PerformanceTestUtil.newPerformanceTest("HTML Highlighting", () -> doTest())
|
||||
Benchmark.newBenchmark("HTML Highlighting", () -> doTest())
|
||||
.warmupIterations(1)
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.intellij.psi.PsiManager
|
||||
import com.intellij.psi.impl.compiled.ClsFileImpl
|
||||
import com.intellij.testFramework.IdeaTestUtil
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.util.io.URLUtil
|
||||
@@ -147,7 +147,7 @@ class IdeaDecompilerTest : LightJavaCodeInsightFixtureTestCase() {
|
||||
val jrt = JavaVersion.current().feature >= 9
|
||||
val base = if (jrt) "jrt://${SystemProperties.getJavaHome()}!/java.desktop/" else "jar://${SystemProperties.getJavaHome()}/lib/rt.jar!/"
|
||||
val file = VirtualFileManager.getInstance().findFileByUrl(base + "javax/swing/JTable.class")!!
|
||||
PerformanceTestUtil.newPerformanceTest("decompiling JTable.class") { decompiler.getText(file) }.start()
|
||||
Benchmark.newBenchmark("decompiling JTable.class") { decompiler.getText(file) }.start()
|
||||
}
|
||||
|
||||
fun testStructureView() {
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.IndexingTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -45,7 +45,7 @@ public class PropertiesPerformanceTest extends JavaCodeInsightTestCase {
|
||||
|
||||
public void testTypingInBigFile() throws Exception {
|
||||
configureByFile(getTestName(true) + "/File1.properties");
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
type(' ');
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
|
||||
backspace();
|
||||
@@ -56,7 +56,7 @@ public class PropertiesPerformanceTest extends JavaCodeInsightTestCase {
|
||||
public void testResolveManyLiterals() throws Exception {
|
||||
final PsiClass aClass = generateTestFiles();
|
||||
assertNotNull(aClass);
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> aClass.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> aClass.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) {
|
||||
PsiReference[] references = expression.getReferences();
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import com.intellij.psi.impl.source.PsiJavaFileImpl;
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import de.plushnikov.intellij.plugin.AbstractLombokLightCodeInsightTestCase;
|
||||
|
||||
public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase {
|
||||
@@ -14,7 +14,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase {
|
||||
final String testName = getTestName(true);
|
||||
loadToPsiFile("/performance/" + testName + "/lombok.config");
|
||||
final PsiFile psiFile = loadToPsiFile("/performance/" + testName + "/HugeClass.java");
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
type(' ');
|
||||
PsiDocumentManager.getInstance(getProject()).commitDocument(getEditor().getDocument());
|
||||
((PsiJavaFileImpl)psiFile).getClasses()[0].getFields()[0].hasModifierProperty(PsiModifier.FINAL);
|
||||
@@ -34,7 +34,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testGeneratedCode() {
|
||||
PerformanceTestUtil.newPerformanceTest("300 unrelated methods", () -> {
|
||||
Benchmark.newBenchmark("300 unrelated methods", () -> {
|
||||
StringBuilder text = new StringBuilder("import lombok.Getter; import lombok.Setter; @interface Tolerate{} class Foo {");
|
||||
for (int i = 0; i < 200; i++) {
|
||||
text.append("@Getter @Setter int bar").append(i).append(";");
|
||||
@@ -57,7 +57,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
public void testGeneratedCodeThroughStubs() {
|
||||
PerformanceTestUtil.newPerformanceTest("200 unrelated methods", () -> {
|
||||
Benchmark.newBenchmark("200 unrelated methods", () -> {
|
||||
StringBuilder text = new StringBuilder("import lombok.Getter; import lombok.Setter; @interface Tolerate{} class Foo {");
|
||||
for (int i = 0; i < 200; i++) {
|
||||
text.append("@Getter @Setter int bar").append(i).append(";");
|
||||
@@ -101,7 +101,7 @@ public class PerformanceTest extends AbstractLombokLightCodeInsightTestCase {
|
||||
classText.append("}");
|
||||
}
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("@Data/@EqualsAndHashCode/@ToString performance", () -> {
|
||||
Benchmark.newBenchmark("@Data/@EqualsAndHashCode/@ToString performance", () -> {
|
||||
myFixture.configureByText("Bar.java", classText.toString());
|
||||
myFixture.checkHighlighting();
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.PerformanceTestUtil;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class PropertiesEnterTest extends LightPlatformCodeInsightTestCase {
|
||||
String line = "some.relatively.long.property.name=And here's some property value for that really unique key, nice to have\n";
|
||||
String text = StringUtil.repeat(line, 20000) + "<caret>\n" + StringUtil.repeat(line, 10000);
|
||||
configureFromFileText("performance.properties", text);
|
||||
PerformanceTestUtil.newPerformanceTest("Property files editing", () -> {
|
||||
Benchmark.newBenchmark("Property files editing", () -> {
|
||||
type("aaaa=bbb");
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
}).start();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user