Bug 330917 - ContainerTreeIterator.isEntryIgnored performs a lot of unnecessary work
Summary: ContainerTreeIterator.isEntryIgnored performs a lot of unnecessary work
Status: CLOSED WONTFIX
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 359052
Blocks:
  Show dependency tree
 
Reported: 2010-11-23 09:09 EST by Robert Munteanu CLA
Modified: 2012-09-08 10:43 EDT (History)
4 users (show)

See Also:


Attachments
Call ratio and spent time in YourKit (17.30 KB, image/png)
2010-11-23 09:10 EST, Robert Munteanu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Munteanu CLA 2010-11-23 09:09:42 EST
When trying to track down slowness in Eclipse, I've noticed that the DecorationScheduler is taking up quite some time. Digging down ( will attach a YourKit snapshot ) I saw that the majority of the work is done by the ContainerTreeIterator.isEntryIgnored, which in turn calls ContainerTreeIterator.isEntryIgnoredByTeamProvider for each of the Resource's parents, up til the workspace root ( or an ignored resource ):


pre.. 
        @Override
        public boolean isEntryIgnored() throws IOException {
                return super.isEntryIgnored() ||
                        isEntryIgnoredByTeamProvider(getResourceEntry().getResource());
        }

        private boolean isEntryIgnoredByTeamProvider(IResource resource) {
                if (resource instanceof IWorkspaceRoot)
                        return false;
                if (Team.isIgnoredHint(resource))
                        return true;
                return isEntryIgnoredByTeamProvider(resource.getParent());

        }

p. 

On average, one method call to isEntryIgnored generates 10 calls to isEntryIgnoredByTeamProvider. This is expected for me, since I'm developing using Java and Maven, which promote deep folder hierarchies. Nevertheless, I believe that a lot of unnecessary Team.isIgnoredHint calls are performed, since in the usual case - resource is not ignored - the resource tree is walked up to the workspace root each time.

Tested with EGit v0.9.3-168-g69a4255 and JGit v0.9.3-224-g34962b4.
Comment 1 Robert Munteanu CLA 2010-11-23 09:10:52 EST
Created attachment 183665 [details]
Call ratio and spent time in YourKit
Comment 2 Robert Munteanu CLA 2010-11-23 09:18:16 EST
The YourKit snapshot is well over the 2MB size enforced by Bugzilla, even when bzipped. I can send it by other means, if needed.
Comment 3 Christian Halstrick CLA 2010-11-24 03:33:53 EST
I would be very interested in this yourkit outcomes. We do have perfomance problems in the iterators and are investigating currently multiple use-cases where this happens (E.g. the commit dialog performance). Since gathering performance measurements is always hard work (can't count how many ours I spent already on TPTP or adding and removing time-measuring code into the code) I would like to see what you got.
Comment 4 Robert Munteanu CLA 2010-11-24 03:44:33 EST
What do you suggest for a 22 MB file?
Comment 6 Christian Halstrick CLA 2010-11-24 05:14:14 EST
thanks, I got the file from dropbox
Comment 7 Robert Munteanu CLA 2010-12-02 05:13:14 EST
http://dl.dropbox.com/u/11860058/org.eclipse.equinox.launcher_1.1.0.v20100507-2010-12-02.snapshot.bz2 contains a Snapshot of Eclipse's startup until it is 'usable'. EGit resource decoration take up roughly 25% of all the spent time - counted across all threads.
Comment 8 Christian Halstrick CLA 2011-03-01 06:56:12 EST
Phillip, you did a lot of improvements on decorations and also on the initial decoration. Do you have any updates on the state of this?
Comment 9 Philipp Thun CLA 2011-05-26 04:21:39 EDT
Hi Robert!

We have implemented several improvements to the decorators in EGit. As this bug was filed a long time ago, it would be good to know, if you already re-tested your scenario with the latest version of EGit and if you still see the same or a similar slowness.

Thanks,
Philipp
Comment 10 Robert Munteanu CLA 2011-05-26 04:27:19 EDT
Hi Phillip.

I will try to reassess this scenario in the coming days and let you know.
Comment 11 Robert Munteanu CLA 2011-06-05 17:36:43 EDT
Hi Phillip,

I've managed to capture a snapshot of the decorator execution times when Eclipse was getting really slugish. This was with {j,e}git 0.12.1,

The file is uploaded at http://dl.dropbox.com/u/3160732/egit-0.12-decorator.snapshot.gz

It clearly shows that:

* the GitDecoratorJob takes up a lot of CPU time ( 41%, which becomes roughly 66% once we exclude the time spent by WorkerPool.sleep )
* org.eclipse.egit.core.ContainerTreeIterator.isEntryIgnored() is at root of a hotspot using org.eclipse.team.internal.core.StringMatcher.textPosIn(String, int, int, String) via org.eclipse.team.core.Team.isIgnoredHint(IResource) ( the original report of this bug )

So in my opinion this report is still valid.
Comment 12 Robin Rosenberg CLA 2012-08-19 17:55:38 EDT
Patch at https://git.eclipse.org/r/7297

Completely untested.
Comment 13 Robin Rosenberg CLA 2012-08-31 11:11:30 EDT
I imported the project set and it takes about 8 sec before the decorator vanishes from the progress menu. It takes about three secs before it appears so it last five seconds, nowhere near several minutes.

The patch has no effect on timing.
Comment 14 Matthias Sohn CLA 2012-09-02 17:05:39 EDT
I tried on Mac using a repository with 60000 files in 7000 directories and couldn't find a significant speedup with this change.
Comment 15 Robin Rosenberg CLA 2012-09-02 17:40:03 EDT
So we could just ignore this since it has no practical effect, or keep the patch as a matter of principle, i.e. avoid the extra calls for free.  I don't even know if it's ok to just check the Team.isIgnoredEntry on just the leafs. Maybe it has to be called on all levels. If nobody knows we'll abandon the patch and close this issue as invalid.
Comment 16 Robert Munteanu CLA 2012-09-06 15:42:39 EDT
I'm going to benchmark this on two different systems with largish repos next week to see if I see any improvements. I assume you're all running on master so I'll install a nightly.
Comment 17 Robin Rosenberg CLA 2012-09-06 17:22:50 EDT
(In reply to comment #16)
> I'm going to benchmark this on two different systems with largish repos next
> week to see if I see any improvements. I assume you're all running on master
> so I'll install a nightly.

It's just a patch in gerrit, i.e. not in the nightly build. Building it
with maven is pretty easy though.
Comment 18 Robin Rosenberg CLA 2012-09-08 10:43:26 EDT
Abandoned/Fixed depending on interpretion of 359052