void () { int N = 100_000; DocumentImpl doc = new DocumentImpl(StringUtil.repeat("x", N)); Editor editor = EditorFactory.getInstance().createEditor(doc); try { FoldingModelEx model = (FoldingModelEx)editor.getFoldingModel(); PlatformTestUtil.startPerformanceTest("restoring many fold regions", 1500, () -> model.runBatchFoldingOperation(() -> { for (int i = 0; i < N; i++) { addAndCollapseFoldRegion(model, i, i+1, "/*...*/"); } })) .setup(()-> model.runBatchFoldingOperation(model::clearFoldRegions)) .assertTiming(); } finally { EditorFactory.getInstance().releaseEditor(editor); } }