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 126157

Summary: Long delay showing Mercurial popup the first time
Product: versioncontrol Reporter: _ tboudreau <tboudreau>
Component: MercurialAssignee: issues@versioncontrol <issues>
Status: RESOLVED FIXED    
Severity: blocker Keywords: PERFORMANCE
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description _ tboudreau 2008-01-28 23:44:23 UTC
Start NetBeans.  Find an nb_all directory in your sources.  Right click it.  Move the mouse over the Mercurial menu item.  The event queue is hung for ~10 
seconds on my Macbook Pro.
Comment 1 John Rice 2008-01-29 16:19:12 UTC
Looking at performance data, appears to be a problem with isIgnored() and annotateFolderNameHtml()

Attaching a patch to optimize annotateFolderNameHtml(). Will look into isIgnore() next.

changeset:   64960:9c49a4583f7e
user:        jrice@netbeans.org
date:        Tue Jan 29 14:03:09 2008 +0000
summary:     #126157: long delay expandingnode in Favorites view - fixes annotate folder issue, still problem with
isIgnored performance

Comment 2 _ tboudreau 2008-01-29 17:01:22 UTC
I would think the right way to do this is to simply do nothing, and queue up a weakly referenced list for FO's that need to get their status checked, then batch 
that after a delay and update status on any that need it and fire changes...

But, I get why annotateFolderNameHtml() is part of the delay in expanding a large folder;  are you sure annotateFolderNameHtml() is the culprit in the delay of 
showing the popup?  At least theoretically, it shouldn't be part of the path to computing a list of popup menu items, unless you're using that to determine 
menu item enabled state...
Comment 3 John Rice 2008-01-29 17:20:16 UTC
I was guilty of not reading the bug carefully, I was just looking at clicking on a clone of main in Favorites and seeing
how long that took to open, which was around 60 secs. This has the problem with isIgnored() and
annotateFolderNameHtml(). The IsIgnored() issue comes about as we need to parse the .hgignore file and do teh pattern
matchiung ourselves as opposed to getting hg support for it. There's a mercurial bug on this.

I'll look into the Mercurial menu popup. We moved a lot of stuff out of the Mercurial menu items isEnabled() code to try
and speed up the popup. Its not ideal as we then don't have context to turn on/off certain menus such as Ignore menu
item for instance, we just have a Toggle Ignore item and invoking the action handler does the right thing. 

The problem is that any hg call takes upwards of 0.5 sec, as we go out of process, so we really tried to reduce them as
much as possible. That's why we need to cache the FileStatus, it is not cheap doing any hg call for us.

The size of the NetBeans repository, number of files, nested NB projects is throwing up other performance issues, but
we'll knock them down one by one. Your testing has been a great help.
Comment 4 John Rice 2008-01-29 17:27:21 UTC
I am not seeing the popup menu issue you describe. I have a clone of hg.netbeans.org/main. I click on the Favorites tab,
I expand the top level node to get at the main clone. I expand it and I do not see a nb_all subdirectory there. I right
click on the main clone folder and the menu comes up right away, then I mouse down to the Mercurial menu and it also
comes up right away.

Can you give me the exact steps to repo. Thanks.
Comment 5 _ tboudreau 2008-01-29 17:39:43 UTC
I think the layout changed;  also whether there's a directory called nb_all or main depends on the arguments to hg clone.  Suffice it to say that it's a clone 
of the main nb repository in a directory ~/main/nb_all - if you do a clone today you'll just get a dir called ~/main.

Anyway, to reproduce:
- Shut down NetBeans
- do the clone into a subdir of ~
- Restart NB
- Open the favorites tab
- Expand the folder with the clone of hg.netbeans.org

I'm sure it's affected by disk throughput.  Mac laptops are notorious for poor disk throughput;  so the issue may be somewhat system dependent.  It's 
much less bothersome on my Linux laptop.
Comment 6 John Rice 2008-02-06 11:54:07 UTC
Various optimizations have gone in, particularly in isIgnored(), so closing this for now. We are having to work around a
Hg bug in status when ignoring directories, which has  a performance hit we can't avoid. There's a fix in mercurial
head, but we won't pick it up until there's a new release.

Reopen if the performance is still unacceptable.