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 48722 - VcsFileSystem.getFile(String) too slow
Summary: VcsFileSystem.getFile(String) too slow
Status: RESOLVED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: vcscore (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2004-09-08 19:33 UTC by Jesse Glick
Modified: 2005-01-11 19:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2004-09-08 19:33:15 UTC
When closing many projects in nb_all, it seems
that 7% of CPU is spent in FileUtil.normalizeFile.
Most of that comes from VcsFS.getFile. Looking at
what calls it, in many cases this method does not
actually have to normalize the file at all! E.g.
if the file is just to be fed into lastModified(),
or folder(), or size(), or inputStream(), there is
no reason to waste time normalizing the file path;
it will make no difference.

Anyway FU.nF is usually used for file paths coming
in from external sources. VcsFS.gF should already
have a normalized rootFile, and probably the
relative file paths are already fine (no "../"
sequences, string case correct because taken from
File.list, etc.).

Consider carefully optimizing this method.
Comment 1 Martin Entlicher 2004-09-09 18:45:46 UTC
You're right, that it's perhaps not necessary to normalize file from
getFile(). This was done so that it's assured at a single place that
all clients get normalized file. However, you're right that not all
clients need to have the file normalized.

I'll look at it and try to optimize...
Comment 2 Martin Entlicher 2005-01-11 19:46:52 UTC
Fixed. VcsFileSystem.getFile() does not return normalized file, the
normalization is done where necessary (hopefully all cases are covered):

/cvs/vcscore/src/org/netbeans/modules/vcscore/VcsAttributes.java,v 
<--  VcsAttributes.java
new revision: 1.39; previous revision: 1.38

/cvs/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java,v 
<--  VcsFileSystem.java
new revision: 1.308; previous revision: 1.307

/cvs/vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandSupport.java,v
 <--  UserCommandSupport.java
new revision: 1.55; previous revision: 1.54

/cvs/vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandTask.java,v
 <--  UserCommandTask.java
new revision: 1.35; previous revision: 1.34

/cvs/vcscore/src/org/netbeans/modules/vcscore/turbo/local/FileAttributeQuery.java,v
 <--  FileAttributeQuery.java
new revision: 1.4; previous revision: 1.3