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 202967 - Parsing performance impact
Summary: Parsing performance impact
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 7.0.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Alexander Simon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-03 09:27 UTC by artisan
Modified: 2011-10-11 14:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
log file (40.89 KB, text/x-log)
2011-10-03 09:55 UTC, artisan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description artisan 2011-10-03 09:27:40 UTC
I've got a C++ project consisting of +/- 22,400 files. When Netbeans starts it takes quite a while to parse the project. Which is okay by me - the project's way too big (but why parsing it all at EACH start ?)

The problem is that I can't work on the other project because the IDE is not very responsive while scanning the project. So basically, I can't use Netbeans while parsing this project.

Personally, I wouldn't mind that, if the repetitive parsing can not be avoided, the parsing takes longer to be more responsive.
Comment 1 Vladimir Voskresensky 2011-10-03 09:39:03 UTC
Could you, please, send you ${userdir}/var/log/message.log file?

One recommendation could be: try to use 32-bit JVM and give IDE more memory
to do that you can 
#netbeans -J-d32 -J-Xmx2G

For big projects increasing memory limit can show huge difference (i.e. 10 times faster parse)
Comment 2 artisan 2011-10-03 09:51:17 UTC
It is a memory consumption problem indeed. From the moment it starts scanning the individual files the memory consumption skyrockets. Looking with VisualVM to what Netbeans is doing. :-)

even with 2GB of heap space the garbage collector is very busy.

Do you want me to send a heap dump ?
Comment 3 artisan 2011-10-03 09:55:29 UTC
Created attachment 111413 [details]
log file
Comment 4 artisan 2011-10-03 09:57:06 UTC
2GB of heap just made it through. :-)

However, the memory consumption remains quite high. Even after extensive GC the heap topped off at 1.2 GB. And I'm editing nothing. Just started Netbeans and let it run through its scanning process.
Comment 5 Vladimir Voskresensky 2011-10-03 09:58:16 UTC
22K of files is really big project. 
As I see you use 64bit JVM could you try 32-bit (which uses almost twice less memory)
Comment 6 artisan 2011-10-03 10:56:14 UTC
I can have a try with that yes. Didn't thought about the reference size for 64bits indeed. Thanks !

In the meantime, another thing that might interest you: Removed a lot of source folders to keep the memory consumption down. But it does only when restarting Netbeans. Removing source folders doesn't lower the memory consumption.
Comment 7 Leonid Lenyashin 2011-10-03 11:52:27 UTC
(In reply to comment #1)
> Could you, please, send you ${userdir}/var/log/message.log file?
> 
> One recommendation could be: try to use 32-bit JVM and give IDE more memory
> to do that you can 
> #netbeans -J-d32 -J-Xmx2G
> 
> For big projects increasing memory limit can show huge difference (i.e. 10
> times faster parse)
Can we integrate this knowledge into the product? It seems much more user
friendly if once we have information on project size, parsing speed, memory
used and memory available (as well as bitness of JVM) we provide user with a
meaningful advice. Does not look too difficult to implement, does it?
Comment 8 artisan 2011-10-03 12:01:39 UTC
That's a good idea indeed - no other IDE does this by my knowledge.

Netbeans' profiler already does something similar; to indicate the burden of the profiling on the system.
Comment 9 artisan 2011-10-04 09:59:55 UTC
Last, but not least, it broke something in the indexing of the open projects. Some classes can not be found by the "Open Type" (CTRL-O) dialog.

Removing the user directory and restarting did the trick. Although it's probably overkill to delete it all.
Comment 10 Leonid Lenyashin 2011-10-04 10:27:13 UTC
You might want to reassign to Alexander
Comment 11 Vladimir Voskresensky 2011-10-04 10:57:02 UTC
(In reply to comment #9)
> Removing the user directory and restarting did the trick. Although it's
> probably overkill to delete it all.
You don't have to delete whole userdir. it's enough to delete userdir/var/cache/cnd/model
Other way is: in project's context menu select Code Assistance->Reparse Project
Comment 12 artisan 2011-10-04 11:05:57 UTC
Thanks ! I just didn't know these options.
Comment 13 Vladimir Voskresensky 2011-10-04 11:45:27 UTC
Btw, after switch to 32bit jvm and increasing memory limit, what is responsiveness of IDE? How long does it take to parse your sources?
Comment 14 Vladimir Voskresensky 2011-10-04 11:46:23 UTC
One more note: normally once parsed we do not reparse project next time you open IDE, we only check for changed files and reparse them and files dependent on them.
Comment 15 Vladimir Voskresensky 2011-10-04 11:48:07 UTC
Alexander, please, implement notification based on number of files, parse time (i.e. how long does it take to go 50% -> 60%) and memory used at checkpoints.
Comment 16 Alexander Simon 2011-10-05 18:04:11 UTC
fixing, change set:
http://hg.netbeans.org/cnd-main/rev/6447c245b999
- show low memory warning in parsing progress message
Comment 17 Quality Engineering 2011-10-06 13:52:08 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/6447c245b999
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #202967 Parsing performance impact
- show low memory warning in parsing progress message
Comment 18 Quality Engineering 2011-10-07 14:41:45 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/6447c245b999
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #202967 Parsing performance impact
- show low memory warning in parsing progress message
Comment 19 Alexander Simon 2011-10-08 05:43:40 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/a60c66a0cbe5

IDE shows a warning in the right bottom corner of the main frame if code model parser needs more memory. On click on the warning IDE shows dialog with an explanation of the problem and with a way how to fix problem.
Dialog is sown once for IDE session.
Implemented following strategy to detect low memory:
- IDE consume more then 90% of all available heap.
- estimated time of remaining parsing is more then 1 minute.
Comment 20 Vladimir Voskresensky 2011-10-08 12:23:24 UTC
I think information about bitness should be checked as well and in case of 64bit JVM we can propose to run (install) 32bit version
Comment 21 Leonid Lenyashin 2011-10-09 15:06:37 UTC
(In reply to comment #19)

> Implemented following strategy to detect low memory:
> - IDE consume more then 90% of all available heap.
> - estimated time of remaining parsing is more then 1 minute.

Isn't 1 minute a too aggressive threshold?
Comment 22 Alexander Simon 2011-10-10 10:47:38 UTC
additional fix, change set:
http://hg.netbeans.org/cnd-main/rev/c33c6ebac12a
- add advice about using 32-bit JVM
Comment 23 Alexander Simon 2011-10-10 10:58:09 UTC
remove debug trace:
http://hg.netbeans.org/cnd-main/rev/eaf469a4eb62
Comment 24 Quality Engineering 2011-10-10 12:23:37 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a60c66a0cbe5
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #202967 Parsing performance impact
- show dialog if code model parser needs more memory
Comment 25 Quality Engineering 2011-10-11 14:07:54 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/c33c6ebac12a
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixing Bug #202967 Parsing performance impact
- add advice about using 32-bit JVM