mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
[benchmarks] Renaming PerformanceTest* => Benchmark*
GitOrigin-RevId: 9963b84d51e1062acc262a8d3d3de1409a708e3b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f4c5a365ab
commit
cdf91bf213
@@ -26,7 +26,7 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.impl.PsiManagerImpl;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
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;
|
||||
@@ -37,7 +37,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase {
|
||||
public void testVisitorPerformance() {
|
||||
Ref<MyElement> ref = new Ref<>();
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("creating", () -> ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
Benchmark.newBenchmark("creating", () -> ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
MyElement element = createElement("<root xmlns=\"http://www.w3.org/1999/xhtml\"/>", MyElement.class);
|
||||
MyElement child = element.addChildElement();
|
||||
child.getAttr().setValue("239");
|
||||
@@ -58,7 +58,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase {
|
||||
|
||||
MyElement newElement = createElement(DomUtil.getFile(ref.get()).getText(), MyElement.class);
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("visiting", () ->
|
||||
Benchmark.newBenchmark("visiting", () ->
|
||||
newElement.acceptChildren(new DomElementVisitor() {
|
||||
@Override
|
||||
public void visitDomElement(DomElement element) {
|
||||
@@ -99,7 +99,7 @@ public class DomPerformanceTest extends DomHardCoreTestCase {
|
||||
final XmlFile file = (XmlFile)getPsiManager().findFile(virtualFile);
|
||||
assertFalse(file.getNode().isParsed());
|
||||
assertTrue(StringUtil.isNotEmpty(file.getText()));
|
||||
PerformanceTestUtil.newPerformanceTest("DOM parsing", () -> assertNull(getDomManager().getFileElement(file))).start();
|
||||
Benchmark.newBenchmark("DOM parsing", () -> assertNull(getDomManager().getFileElement(file))).start();
|
||||
}
|
||||
|
||||
public void testDontParseNamespacedDomFiles() throws Exception {
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
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 org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -53,7 +53,7 @@ public class XmlPerformanceTest extends LightQuickFixTestCase {
|
||||
doHighlighting();
|
||||
getEditor().getSelectionModel().setSelection(0, getEditor().getDocument().getTextLength());
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("indent/unindent " + time, () -> {
|
||||
Benchmark.newBenchmark("indent/unindent " + time, () -> {
|
||||
EditorActionManager.getInstance().getActionHandler("EditorIndentSelection").execute(getEditor(), null,
|
||||
DataManager.getInstance().getDataContext());
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import com.intellij.psi.xml.*;
|
||||
import com.intellij.testFramework.DumbModeTestUtils;
|
||||
import com.intellij.testFramework.InspectionsKt;
|
||||
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.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.xml.XmlAttributeDescriptor;
|
||||
@@ -1237,8 +1237,8 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
IntStream.range(0, 10000).mapToObj(i -> "<!ENTITY pnct" + i + " \"x\">\n").collect(Collectors.joining()) +
|
||||
"]>\n" +
|
||||
"<rules/>");
|
||||
PerformanceTestUtil
|
||||
.newPerformanceTest("highlighting", () -> doHighlighting())
|
||||
Benchmark
|
||||
.newBenchmark("highlighting", () -> doHighlighting())
|
||||
.setup(() -> getPsiManager().dropPsiCaches())
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.intellij.openapi.application.impl.NonBlockingReadActionImpl;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorAction;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
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.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets;
|
||||
public class HtmlEmmetPerformanceTest extends BasePlatformTestCase {
|
||||
public void testPerformance() throws Exception {
|
||||
final String fileContent = FileUtil.loadFile(new File(getTestDataPath() + "/performance.html"), StandardCharsets.UTF_8);
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(true), () -> {
|
||||
Benchmark.newBenchmark(getTestName(true), () -> {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
myFixture.configureByText(HtmlFileType.INSTANCE, fileContent);
|
||||
PsiDocumentManager.getInstance(myFixture.getProject()).commitDocument(myFixture.getDocument(myFixture.getFile()));
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.LightJavaCodeInsightTestCase;
|
||||
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.File;
|
||||
@@ -35,7 +35,7 @@ public class XmlEditorTest extends LightJavaCodeInsightTestCase {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
EditorTestUtil.performTypingAction(getEditor(), '\n');
|
||||
}
|
||||
PerformanceTestUtil.newPerformanceTest("Xml editor enter", () -> {
|
||||
Benchmark.newBenchmark("Xml editor enter", () -> {
|
||||
for (int i = 0; i < 3; i ++) {
|
||||
EditorTestUtil.performTypingAction(getEditor(), '\n');
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.intellij.psi.formatter.xml.XmlCodeStyleSettings;
|
||||
import com.intellij.semantic.SemService;
|
||||
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.impl.CodeInsightTestFixtureImpl;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -43,14 +43,14 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase {
|
||||
}
|
||||
|
||||
public void testReformatCodeFragment() {
|
||||
PerformanceTestUtil.newPerformanceTest("reformat code fragment",
|
||||
() -> checkFormattingDoesNotProduceException("performance")).start();
|
||||
Benchmark.newBenchmark("reformat code fragment",
|
||||
() -> checkFormattingDoesNotProduceException("performance")).start();
|
||||
}
|
||||
|
||||
public void testPerformance3() {
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start();
|
||||
Benchmark.newBenchmark("xml formatter", createTestRunnable()).start();
|
||||
|
||||
highlight();
|
||||
|
||||
@@ -87,7 +87,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase {
|
||||
public void testPerformance4() {
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start();
|
||||
Benchmark.newBenchmark("xml formatter", createTestRunnable()).start();
|
||||
}
|
||||
finally {
|
||||
editorManager.closeFile(editorManager.getSelectedFiles()[0]);
|
||||
@@ -108,7 +108,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase {
|
||||
public void testPerformance5() {
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start();
|
||||
Benchmark.newBenchmark("xml formatter", createTestRunnable()).start();
|
||||
}
|
||||
finally {
|
||||
final VirtualFile[] selectedFiles = editorManager.getSelectedFiles();
|
||||
@@ -121,7 +121,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase {
|
||||
public void testPerformance6() {
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(getProject());
|
||||
try {
|
||||
PerformanceTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start();
|
||||
Benchmark.newBenchmark("xml formatter", createTestRunnable()).start();
|
||||
}
|
||||
finally {
|
||||
final VirtualFile[] selectedFiles = editorManager.getSelectedFiles();
|
||||
@@ -130,7 +130,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase {
|
||||
}
|
||||
|
||||
public void testPerformance7() {
|
||||
PerformanceTestUtil.newPerformanceTest("xml formatter", createTestRunnable()).start();
|
||||
Benchmark.newBenchmark("xml formatter", createTestRunnable()).start();
|
||||
}
|
||||
|
||||
public void testPerformance() throws Exception {
|
||||
@@ -144,7 +144,7 @@ public class XmlPerformanceFormatterTest extends XmlFormatterTestBase {
|
||||
public void testPerformanceIdea148943() throws Exception {
|
||||
final String textBefore = loadFile(getTestName(true) + ".xml", null);
|
||||
final PsiFile file = createFileFromText(textBefore, "before.xml", PsiFileFactory.getInstance(getProject()));
|
||||
PerformanceTestUtil.newPerformanceTest("IDEA-148943", createAdjustLineIndentInRangeRunnable(file))
|
||||
Benchmark.newBenchmark("IDEA-148943", createAdjustLineIndentInRangeRunnable(file))
|
||||
.start();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.intellij.psi.impl.DebugUtil;
|
||||
import com.intellij.testFramework.ExtensionTestUtil;
|
||||
import com.intellij.testFramework.LightIdeaTestCase;
|
||||
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.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -524,7 +524,7 @@ public class HtmlParseTest extends LightIdeaTestCase {
|
||||
ExtensionTestUtil.maskExtensions(ExtensionPointName.create("com.intellij.html.scriptContentProvider"),
|
||||
ContainerUtil.emptyList(), getTestRootDisposable());
|
||||
final Ref<String> result = Ref.create();
|
||||
PerformanceTestUtil.newPerformanceTest("Parsing", () -> result.set(getTreeTextByFile("index-all.html"))).start();
|
||||
Benchmark.newBenchmark("Parsing", () -> result.set(getTreeTextByFile("index-all.html"))).start();
|
||||
assertResult("Performance.txt", result.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.intellij.lexer.XmlLexer;
|
||||
import com.intellij.testFramework.LexerTestCase;
|
||||
import com.intellij.testFramework.ParsingTestCase;
|
||||
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.File;
|
||||
@@ -63,7 +63,7 @@ public class XmlLexerTest extends LexerTestCase {
|
||||
final FilterLexer filterLexer = new FilterLexer(new XmlLexer(),
|
||||
new FilterLexer.SetFilter(new XMLParserDefinition().getWhitespaceTokens()));
|
||||
|
||||
PerformanceTestUtil.newPerformanceTest("XML Lexer Performance on " + fileName, () -> {
|
||||
Benchmark.newBenchmark("XML Lexer Performance on " + fileName, () -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
doLex(lexer, text);
|
||||
doLex(filterLexer, text);
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.intellij.codeInspection.htmlInspections.XmlInspectionToolProvider;
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
import com.intellij.javaee.ExternalResourceManagerExImpl;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
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.xml.analysis.XmlAnalysisBundle;
|
||||
|
||||
@@ -301,7 +301,7 @@ public class XmlNamespacesTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
public void testPatternPerformanceProblem() {
|
||||
myFixture.configureByFile("idproblem.html");
|
||||
PerformanceTestUtil.newPerformanceTest(getTestName(false), () -> myFixture.doHighlighting()).start();
|
||||
Benchmark.newBenchmark(getTestName(false), () -> myFixture.doHighlighting()).start();
|
||||
}
|
||||
|
||||
private void doUnusedDeclarationTest(String text, String after, String name) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.JUnit38AssumeSupportRunner;
|
||||
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.BasePlatformTestCase;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class XmlParsingAdditionalTest extends BasePlatformTestCase {
|
||||
assertNotNull(doc);
|
||||
|
||||
WriteCommandAction.writeCommandAction(project, file).run(
|
||||
() -> PerformanceTestUtil.newPerformanceTest("XML reparse using PsiBuilder", () -> {
|
||||
() -> Benchmark.newBenchmark("XML reparse using PsiBuilder", () -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
final long start = System.nanoTime();
|
||||
doc.insertString(0, "<additional root=\"tag\"/>");
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.intellij.psi.xml.*;
|
||||
import com.intellij.testFramework.JUnit38AssumeSupportRunner;
|
||||
import com.intellij.testFramework.ParsingTestCase;
|
||||
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.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -196,7 +196,7 @@ public class XmlParsingTest extends ParsingTestCase {
|
||||
transformAllChildren(file.getNode());
|
||||
LOG.debug("First parsing took " + (System.nanoTime() - start) + "ns");
|
||||
|
||||
var perfTest = PerformanceTestUtil.newPerformanceTest("XML Parser Performance on " + fileName, () -> {
|
||||
var perfTest = Benchmark.newBenchmark("XML Parser Performance on " + fileName, () -> {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
PsiFile next = createPsiFile("test" + i, text);
|
||||
transformAllChildren(next.getNode());
|
||||
|
||||
Reference in New Issue
Block a user