[java test] big files performance: add JComponent as test data & test with enabled default inspections

GitOrigin-RevId: df0a8aa4c08c0df2acb326a7c0c1280d22ec0adb
This commit is contained in:
Alexandr Suhinin
2021-12-13 11:28:38 +02:00
committed by intellij-monorepo-bot
parent 43091957ed
commit ea82450d0c
3 changed files with 5623 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -36,28 +36,45 @@ import java.util.function.Consumer;
@HardwareAgentRequired
public class BigJavaFilesPerformanceTest extends LightJavaCodeInsightFixtureTestCase5 {
public void _testHighlightingThinletBig() {
long mean = doHighlightingTest("/psi/resolve/ThinletBig.java", 9);
Assertions.assertTrue(mean < 60_000);
}
public void _testHighlightingWithInspectionsThinletBig() {
MadTestingUtil.enableAllInspections(getFixture().getProject());
long mean = doHighlightingTest("/psi/resolve/ThinletBig.java", 9);
Assertions.assertTrue(mean < 100_000);
@Test
public void testHighlightingJComponent() {
long mean = doHighlightingTest("/codeInsight/bigFilesPerformance/JComponent.java", 9);
Assertions.assertTrue(mean < 10_000);
}
@Test
public void testTypingThinletBig() {
long mean = doTypingTest("/psi/resolve/ThinletBig.java", 50,false);
public void testHighlightingWithInspectionsJComponent() {
MadTestingUtil.enableDefaultInspections(getFixture().getProject());
long mean = doHighlightingTest("/codeInsight/bigFilesPerformance/JComponent.java", 9);
Assertions.assertTrue(mean < 15_000);
}
@Test
public void testTypingJComponent(){
long mean = doTypingTest("/codeInsight/bigFilesPerformance/JComponent.java", 50, false);
Assertions.assertTrue(mean < 25);
}
@Test
public void testTypingWithInspectionsJComponent(){
MadTestingUtil.enableDefaultInspections(getFixture().getProject());
long mean = doTypingTest("/codeInsight/bigFilesPerformance/JComponent.java", 50, true);
Assertions.assertTrue(mean < 50);
}
@Test
public void testHighlightingWithInspectionsThinletBig() {
MadTestingUtil.enableDefaultInspections(getFixture().getProject());
long mean = doHighlightingTest("/psi/resolve/ThinletBig.java", 9);
System.out.println("Warnings: " + getFixture().doHighlighting().size());
Assertions.assertTrue(mean < 75_000);
}
@Test
public void testTypingWithInspectionsThinletBig() {
MadTestingUtil.enableAllInspections(getFixture().getProject());
MadTestingUtil.enableDefaultInspections(getFixture().getProject());
long mean = doTypingTest("/psi/resolve/ThinletBig.java", 50,true);
Assertions.assertTrue(mean < 100);
Assertions.assertTrue(mean < 70);
}
private void doTest(String filename, int samples, Consumer<DaemonListener> processSample) {
@@ -174,11 +191,11 @@ public class BigJavaFilesPerformanceTest extends LightJavaCodeInsightFixtureTest
System.out.println("Intervals: " + typingTimings);
System.out.println("Adjusted intervals: " + adjustedTimings);
System.out.println("Mean: " + mean);
System.out.println(crateMetaDataForTeamCity("mean", mean));
System.out.println(createMetaDataForTeamCity("mean", mean));
return mean;
}
private static String crateMetaDataForTeamCity(String name, long value){
private static String createMetaDataForTeamCity(String name, long value){
return "##teamcity[testMetadata name='" + name + "' type='number' value='" + value + "']";
}

View File

@@ -180,6 +180,16 @@ public final class MadTestingUtil {
for (String shortId : except) {
disableInspection(project, profile, shortId);
}
replaceProfile(project, profile);
}
public static void enableDefaultInspections(@NotNull Project project) {
InspectionProfileImpl.INIT_INSPECTIONS = true;
InspectionProfileImpl profile = new InspectionProfileImpl("defaultInspections");
replaceProfile(project, profile);
}
private static void replaceProfile(@NotNull Project project, InspectionProfileImpl profile) {
// instantiate all tools to avoid extension loading in inconvenient moment
profile.getAllEnabledInspectionTools(project).forEach(state -> state.getTool().getTool());