This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197640 - optimize/rewrite MarkupAbstractIndenter.calculateAllVirtualCloseTagsForOpenTag and calculateAllVirtualCloseTagsForCloseTag
Summary: optimize/rewrite MarkupAbstractIndenter.calculateAllVirtualCloseTagsForOpenTa...
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks: 197458
  Show dependency tree
 
Reported: 2011-04-12 03:12 UTC by David Konecny
Modified: 2011-04-14 08:35 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Konecny 2011-04-12 03:12:09 UTC
On test case file attached to issue 197458 these two methods are bottleneck. Try for example indent line 17066. There are several problems and I will need to have a more detailed look how to resolve them. For example the document states that it is "XHTML 1.0 Strict" which is not true as most of the closing tags are missing. Result of that is that indentation of lines is growing and close to the end of document is on average about 14000 characters! That's why reformat of the file is extremely long. Turning it into relaxed HTML causes different problems - as most of the tags have optional end much more time is spent (that is wasted) in going backwards to find a firm start.
Comment 1 Marek Fukala 2011-04-12 12:59:25 UTC
I suppose this issue covers the fact that after fixing the exception triggered by each enter now one CPU core is fully occupied by the EDT task execution for about a second after pressing enter somewhere inside the document...

I've realized that at HtmlIndenter:76 the fresh parser result creation is invoked synchronously in EDT, which is apparently wrong and consumes about 40% of the time mentioned above - Bug 197659 - do not parse file in EDT during each enter key press
Comment 2 David Konecny 2011-04-13 01:40:56 UTC
(In reply to comment #1)
> I suppose this issue covers the fact that after fixing the exception triggered
> by each enter now one CPU core is fully occupied by the EDT task execution for
> about a second after pressing enter somewhere inside the document...

Yes and no. This issue contributes to the slowdown a lot but I cannot say that resolving it will make everything fast.
Comment 3 David Konecny 2011-04-13 01:46:12 UTC
In the end this was not that hard. There was a method stub in AbstractIndenter which I never implemented and so implementing that method solved this issue. :-) The method is removing processed items from internal stack on which indenter operates. And in case of very large file which in addition has lots of close tags optional the stack got enormous (>10000 items).

5e88d61b5224
Comment 4 Quality Engineering 2011-04-14 08:35:32 UTC
Integrated into 'main-golden', will be available in build *201104140401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/5e88d61b5224
User: David Konecny <dkonecny@netbeans.org>
Log: #197640 - optimize/rewrite MarkupAbstractIndenter.calculateAllVirtualCloseTagsForOpenTag and calculateAllVirtualCloseTagsForCloseTag