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 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()); }
@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 }
@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(); }
private void doHighlightingTest(long expectation) { PlatformTestUtil.startPerformanceTest(getTestName(true), (int)expectation, () -> myFixture.testHighlighting(true, false, false, getTestName(true) + ".go")).cpuBound().usesAllCPUCores().assertTiming(); }
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(); }