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 169166 - Indexing tries to find projects for files under $NB_INSTALL
Summary: Indexing tries to find projects for files under $NB_INSTALL
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-07-25 07:17 UTC by _ tboudreau
Modified: 2009-08-08 07:04 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
log file w/ stack traces (400.07 KB, text/plain)
2009-07-25 07:19 UTC, _ tboudreau
Details
Log file over testuserdir - 95 calls to isVisible() including for such files as nbbuild/testuserdir/var/cache/index/s7/java/14/checksums.properties (275.18 KB, text/plain)
2009-07-25 07:51 UTC, _ tboudreau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2009-07-25 07:17:11 UTC
While writing a patch for issue 169160, I noticed that the parsing API tries to look up the owning project for many
files underneath the NetBeans install root.  There is probably never a case where there will be a project present (see
below - it actually is worse if your userdir is underneath $NB_SRC/nbbuild).  This certainly slows down project
scanning, and does pointless work;  the project lookup should be skipped for such files.

The behavior is even worse if you are running w/ $NBBUILD/testuserdir as your userdir, as the project for
nbbuild/nbproject is looked up hundreds of times and this happens on every change in the system filesystem.

See attached log - I added some logging code to log the stack trace whenever the call was to look up a project under
$NB_SRC.
Comment 1 _ tboudreau 2009-07-25 07:19:29 UTC
Created attachment 85208 [details]
log file w/ stack traces
Comment 2 _ tboudreau 2009-07-25 07:48:13 UTC
Several optimizations are possible here.  The particular problem with the PHP module was that its VisibilityQuery was
using FileOwnerQuery to look up a PHP project;  my optimization simply first checks if any nbproject/ subdir of a parent
exists.

1.  Probably something like this should be done for all VisibilityQueries, or ideally centralized if possible. 
FileOwnerQuery should be a last resort, not the first choice.

2.  Detect if running under $NB_SRC/nbbuild/testuserdir and correct for that situation - while this is not useful to
users, it means that when we are doing development and testing changes, the IDE is behaving the same way it would behave
for a normal user (i.e. not trying to find a project for every file in the system filesystem every time a file in the
system fs changes).  Right now, running with a userdir under nbbuild means that every system filesystem change triggers
a call to VisibilityQuery and resolves $NBPROJECT/nbbuild as the owning project.  That both makes performance
measurements when running w/ testuserdir meaningless (the IDE is doing extra and different work), and means that when we
are trying to reproduce bugs, we are not really running in a similar environment to the bug reporter.

Currently 

3.  Where possible, if a uniquely named file is present under $PROJECT/nbproject or some other file signature test (e.g.
"phpproject" instead of "nbproject") can be applied to determine if a project is really owned by a particular project
type, many VisibilityQuery implementations could probably avoid the expense of reading the project.xml, or at least
delay it until the project instance is really needed.
Comment 3 _ tboudreau 2009-07-25 07:51:23 UTC
Created attachment 85211 [details]
Log file over testuserdir - 95 calls to isVisible() including for such files as nbbuild/testuserdir/var/cache/index/s7/java/14/checksums.properties
Comment 4 Petr Jiricka 2009-07-27 10:05:56 UTC
Adjusting the category.
Comment 5 Vitezslav Stejskal 2009-08-07 13:00:53 UTC
All events under the indexing chache folder are now quickly filtered out.

http://hg.netbeans.org/jet-main/rev/ee9f0595df2e
Comment 6 Quality Engineering 2009-08-08 07:04:39 UTC
Integrated into 'main-golden', will be available in build *200908080201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ee9f0595df2e
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #169166: filtering out events concerning files under the indexing cache folder