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 189647 - Formatting takes too long - holding document lock
Summary: Formatting takes too long - holding document lock
Status: RESOLVED INCOMPLETE
Alias: None
Product: javascript
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords: PERFORMANCE
: 188495 229041 229278 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-18 17:59 UTC by tbrunhoff
Modified: 2014-06-27 15:55 UTC (History)
22 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 172014


Attachments
nps snapshot (13.54 KB, application/nps)
2010-08-18 17:59 UTC, tbrunhoff
Details
nps snapshot (10.22 KB, application/nps)
2010-08-29 22:24 UTC, charlweed
Details
Sample Javascript file (31.06 KB, text/plain)
2013-05-28 22:58 UTC, _ gtzabari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tbrunhoff 2010-08-18 17:59:17 UTC
This bug was originally marked as duplicate of bug 183421, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE Dev (Build 201008050001)
VM: Java HotSpot(TM) 64-Bit Server VM, 16.0-b13, Java(TM) SE Runtime Environment, 1.6.0_18-b07
OS: Linux

User Comments:
tbrunhoff: After a refactor -- renaming a member variable.



Maximum slowness yet reported was 3217 ms, average is 3217
Comment 1 tbrunhoff 2010-08-18 17:59:21 UTC
Created attachment 101497 [details]
nps snapshot
Comment 2 charlweed 2010-08-29 22:24:42 UTC
Created attachment 101741 [details]
nps snapshot

Starting new build of  NB with new User Dir.
Comment 3 Stanislav Aubrecht 2010-10-07 10:20:48 UTC
*** Bug 188495 has been marked as a duplicate of this bug. ***
Comment 4 Stanislav Aubrecht 2010-10-18 14:04:46 UTC
slow native painting
Comment 5 tbrunhoff 2010-10-18 14:18:04 UTC
What is the solution for "slow native painting."? Is it a bad X server (currently vanilla fedora 12), my graphics card (NVidia GForce 8600), my cpu (quad core core 2)?
Comment 6 Stanislav Aubrecht 2011-01-27 10:08:01 UTC
(In reply to comment #5)
> What is the solution for "slow native painting."? Is it a bad X server
> (currently vanilla fedora 12), my graphics card (NVidia GForce 8600), my cpu
> (quad core core 2)?

no idea. but it's something we can't fix in netbeans. try more recent jdk update.
Comment 7 _ gtzabari 2012-11-13 23:20:10 UTC
Stanislav,

Take a look at http://statistics.netbeans.org/analytics/exception.do?id=628793

This has nothing to do with slow native painting. It has to do with the painting thread waiting on an expensive operation such as Code Format of a large file.

It seems to me the exception reporter should subtract this time (waiting on a lock) from the actual time the operation took and/or figure out the operation that was really slow was code-format, not the painting thread.
Comment 8 Stanislav Aubrecht 2012-11-15 13:48:04 UTC
DiffSidebar.paintComponent() calls into editor.Utilities.runViewHierarchyTransaction(), versioning team, please evaluate, thanks.

(more than 200 reports -> P2)
Comment 9 Tomas Stupka 2012-11-19 09:57:58 UTC
> DiffSidebar.paintComponent() calls into editor.Utilities.runViewHierarchyTransaction(), versioning team, please evaluate, thanks.
> (more than 200 reports -> P2)
editor please evaluate
Comment 10 David Strupl 2012-11-20 08:26:44 UTC
The problem is that repainting is blocked by formatting. The times are really ridiculous - it is real P2 IMHO.

The formatting is either triggered by the user or in some reports automatically on save which is even worse.
Comment 11 Dusan Balek 2012-11-20 08:54:56 UTC
Looking at the last couple of profiler snapshots coming from 7.3 beta 2, AWT EDT is waiting an extremely slow javascript reformatting holding document lock.
Comment 12 Petr Hejl 2012-11-20 10:11:35 UTC
igorrius, can you provide document for testing? What is the size of document? I don't think formatter is extremely slow - it may take some time for huge, completely wrongly formatted (minified) files.
Comment 13 Petr Hejl 2012-11-20 10:18:45 UTC
Slow operations are not in the formatter itself, but in actual document modifications - 36s out of 39s.
Comment 14 Petr Hejl 2012-11-20 10:25:42 UTC
I went through the last couple of 7.3 reports and only two of them (igorrius) are JS related and both of them represents the same file.
Comment 15 Petr Hejl 2012-11-20 10:44:42 UTC
The file is also not parsable for some reason. We need the file to evaluate.
Comment 16 Petr Hejl 2012-11-20 10:46:39 UTC
igorrius, can you share a file causing this?
Comment 17 _ gtzabari 2013-05-28 22:58:04 UTC
Created attachment 135034 [details]
Sample Javascript file

Here is a sample Javascript file that takes 12 seconds to format on my powerful desktop PC. Please let me know if you need anything else to reproduce and fix this issue.
Comment 18 _ gtzabari 2013-05-28 23:03:03 UTC
I should note I am using:

Product Version: NetBeans IDE Dev (Build 201305232300)
Java: 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev
Comment 19 Dusan Balek 2013-05-29 13:26:11 UTC
*** Bug 229278 has been marked as a duplicate of this bug. ***
Comment 20 Petr Hejl 2013-07-12 18:19:54 UTC
(In reply to comment #17)
> Created attachment 135034 [details]
> Sample Javascript file
> 
> Here is a sample Javascript file that takes 12 seconds to format on my powerful
> desktop PC. Please let me know if you need anything else to reproduce and fix
> this issue.

This took about 2 seconds for me. It might be influenced by OS and FS. Note that whenever you format a file the major portion of time is spent with document changes - if the document is completely broken (in terms of formatting) the formatting is slower. This is the case of the sample, every line is reindented as original doc is using tabs. Formatting of this document once formatted initially is immediate.
Comment 21 Petr Hejl 2013-08-13 13:47:44 UTC
Is there a reproducible case where minor portion of the document is changed and it takes a long time?
Comment 22 Petr Hejl 2013-08-23 09:06:24 UTC
*** Bug 229041 has been marked as a duplicate of this bug. ***
Comment 23 Petr Hejl 2014-06-27 15:55:53 UTC
Reproducible test case requested. Also there has been improvements recently for project specific formatting settings.