void () { configureByFile("/psi/resolve/ThinletBig.java"); // wait for default project to dispose, otherwise it will be very slow while (ProjectManagerEx.getInstanceEx().isDefaultProjectInitialized()) { UIUtil.dispatchAllInvocationEvents(); if (System.currentTimeMillis() % 10_000 < 100) { System.out.println("waiting for default project dispose..."); TimeoutUtil.sleep(100); } } assertNotNull(ProjectCoreUtil.theOnlyOpenProject()); getFile().accept(new PsiRecursiveElementVisitor() {}); Project myProject = getProject(); PlatformTestUtil.startPerformanceTest("getProject() for nested elements", 5000, () -> { for (int k=0; k<5; k++) { getFile().accept(new PsiRecursiveElementVisitor() { int c; @Override public void visitElement(@NotNull PsiElement element) { for (int i = 0; i < 100; i++) { assertSame(myProject, element.getProject()); } if (c++ % 100 == 0) { assertNotNull(ProjectCoreUtil.theOnlyOpenProject()); } super.visitElement(element); } }); } }).assertTiming(); }