private void doCompletionTest(@NotNull String source, int invocationCount, long expectation) { VirtualFile go = installTestData("go"); if (go == null) return; myFixture.configureByText(GoFileType.INSTANCE, source); PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expectation, () -> myFixture.complete(CompletionType.BASIC, invocationCount)).cpuBound().usesAllCPUCores().assertTiming(); }
public void testParserAndStubs() { File go = new File(getTestDataPath(), "go"); if (!go.exists()) { System.err.println( "For performance tests you need to have a go sources (https://storage.googleapis.com/golang/go1.4.2.src.tar.gz) inside testData/" + getBasePath() + " directory"); return; } PlatformTestUtil.startPerformanceTest(getTestName(true), (int)TimeUnit.MINUTES.toMillis(1), () -> { VirtualFile root = LocalFileSystem.getInstance().findFileByIoFile(go); assertNotNull(root); VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() { @NotNull @Override public Result visitFileEx(@NotNull VirtualFile file) { if (file.isDirectory() && "testdata".equals(file.getName())) return SKIP_CHILDREN; if (file.isDirectory() && "test".equals(file.getName()) && file.getParent().equals(root)) return SKIP_CHILDREN; if (file.getFileType() != GoFileType.INSTANCE) return CONTINUE; try { System.out.print("."); buildStubTreeText(getProject(), file, FileUtil.loadFile(new File(file.getPath()), "UTF-8", true).trim(), true); } catch (IOException ignored) { } return CONTINUE; } }); }).usesAllCPUCores().assertTiming(); }
private void doHighlightingTest(long expectation) { PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expectation, () -> myFixture.testHighlighting(true, false, false, getTestName(true) + ".go")).cpuBound().usesAllCPUCores().assertTiming(); }
private void doInspectionTest(@NotNull InspectionProfileEntry tool, long expected) { VirtualFile sourceDir = installTestData("docker"); if (sourceDir == null) return; //noinspection ConstantConditions AnalysisScope scope = new AnalysisScope(getPsiManager().findDirectory(sourceDir)); scope.invalidate(); InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject()); InspectionToolWrapper wrapper = InspectionToolRegistrar.wrapTool(tool); GlobalInspectionContextForTests globalContext = CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, wrapper); PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expected, () -> InspectionTestUtil.runTool(wrapper, scope, globalContext)).cpuBound().usesAllCPUCores().assertTiming(); InspectionTestUtil.compareToolResults(globalContext, wrapper, false, new File(getTestDataPath(), wrapper.getShortName()).getPath()); }
public void testPerlTidyLexing() { String testData = getPerlTidy(); final int iterations = 100; System.err.println("Warming up..."); for (int i = 0; i < iterations; i++) { testLexing(testData); } final int time = 70; PlatformTestUtil.startPerformanceTest("PerlTidy lexing", iterations * time, () -> { long length = 0; for (int i = 0; i < iterations; i++) { length += testLexing(testData); } System.err.println("Lexing done in " + length / iterations + " ms per iteration of " + time); }).attempts(1).assertTiming(); }
public void testPerlTidyParsing() { final String testData = getPerlTidy(); final int iterations = 30; PsiFile psiFile; for (int i = 0; i < iterations; i++) { psiFile = createPsiFile("test", testData); psiFile.getFirstChild(); } final int time = 400; PlatformTestUtil.startPerformanceTest("PerlTidy parsing", iterations * time, () -> { long start = System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { PsiFile psiFile1 = createPsiFile("mytest", testData); psiFile1.getFirstChild(); } long length = System.currentTimeMillis() - start; System.err.println("Parsing done in " + length / iterations + " ms per iteration of " + time); }).assertTiming(); // analyzeFile(psiFile); }
public void testEnterTyping() { initWithPerlTidy(); myFixture.getEditor().getCaretModel().moveToLogicalPosition(new LogicalPosition(65, 0)); final int iterations = 30; for (int i = 0; i < iterations; i++) { myFixture.type("\n"); } final int time = 1000; PlatformTestUtil.startPerformanceTest("PerlTidy enter typing", iterations * time, () -> { long start = System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { myFixture.type("\n"); } long length = System.currentTimeMillis() - start; System.err.println("Typing enter done in " + length / iterations + " ms per iteration of " + time); }).assertTiming(); }
@Test public void testHighlightingPerformanceSmall() throws Exception { PlatformTestUtil.startPerformanceTest(getTestName(true), 35 * 500, new ThrowableRunnable() { @Override public void run() throws Throwable { //Average: 550.4 ms doPerformanceTest("AlsaUtils.bash", 35, 500.0); } }).usesAllCPUCores().usesAllCPUCores().assertTiming(); }
@Test @Ignore public void testHighlightingPerformanceLarge() throws Exception { PlatformTestUtil.startPerformanceTest(getTestName(true), 10 * 2000, new ThrowableRunnable() { @Override public void run() throws Throwable { doPerformanceTest("functions_issue96.bash", 10, 2000.0); } }).usesAllCPUCores().usesAllCPUCores().assertTiming(); // With tuning: // Finished highlighting 10/10, avg: 20538,100000 ms, min: 18969 ms, max: 22855 ms }
PlatformTestUtil.startPerformanceTest("PerlTidy highlighting", iterations * time, () -> { long start = System.currentTimeMillis(); for (int i = 0; i < iterations; i++) {