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 151916 - Editor very slow in rendering single line javascript/css files resulting in Netbeans hang
Summary: Editor very slow in rendering single line javascript/css files resulting in N...
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Miloslav Metelka
Depends on: 121357 150204
  Show dependency tree
Reported: 2008-10-30 22:35 UTC by Sonali Kochar
Modified: 2012-10-26 13:35 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Sonali Kochar 2008-10-30 22:35:27 UTC
The HTTP Client monitor displays the HTTP response body in a JEditor. If the response body is not formatted i.e all the
content is in single line, then the editor has performance issues while rendering the files causing Netbeans to hang. 

Please see issue 148996 for:
1) Stack traces
2) Profiler call tree
3) Profiler hot spots
4) A sample project to reproduce the issue

Please note we implemented a workaround for issue 148996 so to see this issue you need to get version 104156 of

Please email me if you need any help in reproducing the issue
Comment 1 Jan Becicka 2008-11-03 08:39:13 UTC
Milo, please evaluate. Thanks
Comment 2 Miloslav Metelka 2008-11-03 14:25:04 UTC
I was able to reproduce the problem in current dev build.
There does not seem to be anything wrong but I will continue profiling of the highlighting layers to search for
The single-line javascript has ~100K of text.
I personally don't see what's a benefit for the user to see 100K of text on a single line. IMHO the line should be
reformatted into a regular indented text so that the user can orient in it.
I'm downgrading to P3 since this is not a typical editing usecase.
Comment 3 Miloslav Metelka 2008-11-07 10:10:16 UTC
I have made some additional profiling. There are
1) 103389 chars in the js-script-min.js document.
2) 7 BaseDocument.insertString() invocations (there is a buffer with 16384 chars for insertions).
  These could be collapsed into a single insert by reallocating the buffer before the actual insert but I consider that
3) 38804 tokens in the document.

I see two problems:
a) Since almost all the chars are on a single line each repetitive insertion in 2) causes re-measurement of the
particular line in the view hierarchy (DrawEngineLineView.getPreferredSpan() gets called leading to DrawEngine.draw()
called for measurements).
  - A new view hierarchy (issue 121357) should improve the situation considerably since the views will maintain their
span internally so there will be no additional re-measurements done.
b) Token hierarchy is updated after each sub-insert in 2) leading to repetitive updates of syntax highlighting layer.
  - This should be improved by switching the TH off before document loading and on after the loading - issue 150204
(planned for 7.0).

I have added some logging of syntax highlighting and token hierarchy events and views rebuilding:
Comment 4 Quality Engineering 2008-11-07 16:20:20 UTC
Integrated into 'main-golden', will be available in build *200811071401* on (upload may still be in progress)
User: Miloslav Metelka <>
Log: #151916 - Editor very slow in rendering single line javascript/css files resulting in Netbeans hang.
Comment 5 David Strupl 2012-10-25 13:39:16 UTC
Bug prior to 7.0, not touched for the last 2 years --> P4.
Comment 6 David Strupl 2012-10-26 13:35:55 UTC
I think this was fixed long ago by Mila.