Community
Participate
Working Groups
wtp 3.0 m3 There've been many complaints in the past regarding how slow the xml formatter is. Improvements have been already been made, but one way to speed it up even more is to use TextEdits to format the document. The formatter now currently modifies the text as it attempts to format each node. This results in many document/model notifications and constant updates. Using text edits would batch up all the edits and the edits would be made after determining how to format each node.
Created attachment 85626 [details] sse.ui.xml.core.xml.ui.patch xml.core new classes -DefaultXMLPartitionFormatter - the new xml formatter -XMLFormattingConstraints - formatting context passed from node to node during formatting (available line width, whether or not currently indenting) -XMLFormattingPreferences - contains formatting preferences -XMLFormatterFormatProcessor - turns the new formatting into the old istructuredformatprocessor (still necessary for cleanup and file formatting) xml.ui -created an xml formatting strategy and in the xml viewer configuration, when setting up multipasscontentformatter, use the new xml formatting strategy -the xml formatting strategy basically calls the Default sse.ui -just added a debug statement in StructuredTextMultiPassContentFormatter to time how long formatting takes
Created attachment 85627 [details] xml.core.tests.patch Unit tests for new xml formatter. I basically took the existing unit tests for the old xml formatter and made them use the new formatter. There were instances where the results were different, but upon further investigation, it looked like the results were still correct. So in those cases, I just updated the results so they reflected the new results from the new formatter.
Created attachment 85631 [details] formattingresults.txt Running the FormatTest performance test in xml.ui.tests.performance, the new xml formatter was over 50% faster. I also compared formatting results when formatting a.xml from bug 144224 (a.xml is 323kb & semi-formatted) Unless I messed up on the math, the new xml formatter was 70-90% faster! I've attached the performance test details in case anyone was interested.
fix released for this week's wtp 3.0 m4 build.
verified using wtp3.0M4 20080103204922