Community
Participate
Working Groups
Build Identifier: org.eclipse.wst.sse.ui 1.2.3v201010160450 28.10.2010 23:38:14 Seems, the algorithm to find the foldings in org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy.getIndexedRegions(IStructuredModel, IStructuredDocumentRegion[]) is really poor: on a XML file with about 1 MB, 6000 lines and 12000 XML regions, e.g. org.eclipse.wst.xml.core.internal.document.NodeImpl.getEndOffset() is called about 50 (!) million (!!) times (plus some other methods similar often), and because of this consuming several seconds CPU time during opening the XML editor. Disabling folding reduces this to a acceptable amount of time (several 100 ms only). Reproducible: Always Steps to Reproduce: Open a large XML file containing 1000+ XML regions, having folding enabled.
CQ:WIND00253653
Created attachment 188275 [details] possible patch, haven't verified performance impact
(In reply to comment #2) > Created attachment 188275 [details] > possible patch, haven't verified performance impact I ran some fairly informal tests that basically calculated the time it took to get the indexed regions in AbstractStructuredFoldingStrategy. Before the patch, it took on average 2867.16ms to get the indexed regions. After the patch, it went down to an average of 1258ms. This was for a file at about 2.9MB.
Walter: Do you think 1.2 sec are acceptable for a 3 MB file ? Nitin: Since your patch does seem to improve things, can it be committed? Do you see potential for more improvement? Nick: Anything else I'm forgetting?
Hm, given the fact, that all this is in memory, the time being used feels still way too high. However, I understand the algorithm might be hard to change in a simple way, but it should not behave non-linear after all.
Created attachment 190069 [details] patch 2 (In reply to comment #4) > Nitin: Since your patch does seem to improve things, can it be committed? > Do you see potential for more improvement? After rereading it a bit, here's a newer version that tightens things up a little more. I don't think it will have a measurable improvement over the original, but it's a little more straightforward. Yes, I believe that it can be committed.
New patch looks fine as well.
Released in 3.2.4 and committed to HEAD.