mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: add control flow performance test case (IDEA-375157)
GitOrigin-RevId: 727c25aa60c6862dcf87d6b9a0dcb7278f2dce3b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6e4ed79cc0
commit
92cf2f8dfa
File diff suppressed because it is too large
Load Diff
+21
-3
@@ -1,16 +1,34 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.codeInsight.psi;
|
||||
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.controlFlow.ControlFlow;
|
||||
import com.intellij.psi.controlFlow.ControlFlowFactory;
|
||||
import com.intellij.psi.controlFlow.ControlFlowUtil;
|
||||
import com.intellij.psi.controlFlow.LocalsControlFlowPolicy;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testFramework.LightJavaCodeInsightTestCase;
|
||||
import com.intellij.tools.ide.metrics.benchmark.Benchmark;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
public class ControlFlowPerformanceTest extends LightJavaCodeInsightTestCase {
|
||||
@NonNls private static final String PATH = "/psi/controlFlowPerf/";
|
||||
|
||||
public void testManyLocalVariables() {
|
||||
configureByFile(PATH + getTestName(false) + ".java");
|
||||
PsiFile file = getFile();
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
PsiTreeUtil.processElements(file, element -> {
|
||||
if (element instanceof PsiLocalVariable var) {
|
||||
final PsiCodeBlock scope = PsiTreeUtil.getParentOfType(var, PsiCodeBlock.class);
|
||||
ControlFlowUtil.isEffectivelyFinal(var, scope);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void testHugeMethodChainControlFlow() {
|
||||
Benchmark.newBenchmark(getTestName(false), () -> {
|
||||
int size = 2500;
|
||||
|
||||
Reference in New Issue
Block a user