void () { String text = "<!DOCTYPE rules [\n" + IntStreamEx.range(0, 1000).mapToObj(i -> "<!ENTITY pnct" + i + " \"x\">\n").joining() + "]>\n" + "<rules> content </rules><caret>"; int offset1 = text.indexOf("content"); int offset2 = text.indexOf("\n<!ENTITY"); PsiFile file = myFixture.configureByText("a.xml", text); PlatformTestUtil .startPerformanceTest("text extraction", 1_000, () -> { assertEquals("content", TextExtractor.findTextAt(file, offset1, TextContent.TextDomain.ALL).toString()); assertNull(TextExtractor.findTextAt(file, offset2, TextContent.TextDomain.ALL)); }) .setup(() -> { myFixture.type(' '); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); // drop file caches }) .assertTiming(); }