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 53854 - MasterFS repeated isFolder() call is slow
Summary: MasterFS repeated isFolder() call is slow
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: 4.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: rmatous
URL:
Keywords: PERFORMANCE
Depends on:
Blocks: 46900
  Show dependency tree
 
Reported: 2005-01-24 02:57 UTC by Jaroslav Tulach
Modified: 2008-12-22 20:25 UTC (History)
1 user (show)

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 Jaroslav Tulach 2005-01-24 02:57:09 UTC
During expanding of folder a lot of calls to
isFolder method is done as the default sorting
order order puts folders in front of files, it
needs to check isFolder method for each file,
moreoever it asks for each file more times.

The sorting is done by quicksort, which is of
O(n*log(n)) complexity. That means for 10000 files
in a folder 120000 needed comparitions of two
files, which results in 240000 queries to
isFolder. This took about 20% of the actual folder
expasion. See:

37.88% - 9330.0 ms - 123579 inv. -
org.openide.loaders.FolderOrder.compare()
  33.88% - 8345.0 ms - 123579 inv. -
org.openide.loaders.FolderComparator.compare()
    32.59% - 8026.0 ms - 123579 inv. -
org.openide.loaders.FolderComparator.compareFoldersFirst()
      20.41% - 5027.0 ms - 247157 inv. -
org.netbeans.modules.masterfs.MasterFileObject.isFolder()
        5.49% - 1353.0 ms - 247157 inv. -
org.netbeans.modules.masterfs.Delegate.get()
        3.34% - 824.0 ms - 245999 inv. -
org.netbeans.modules.masterfs.MasterFileObject.getValidOrInvalid()
        2.48% - 611.0 ms - 492504 inv. -
org.netbeans.modules.masterfs.MasterFileObject.getDelegate()
        2.37% - 584.0 ms - 244605 inv. -
org.netbeans.modules.masterfs.Delegate.hasMountAbleFlag()
        1.37% - 338.0 ms - 237184 inv. -
org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.isFolder()
      7.7% - 1897.0 ms - 123204 inv. -
org.openide.loaders.FolderComparator.compareNames()
      1.6% - 395.0 ms - 242480 inv. -
org.openide.loaders.FolderComparator.findFileObject()
  0.62% - 154.0 ms - 123075 inv. -
org.openide.loaders.FolderOrder.getSortMode()

I believe this is unnecessary. The check for
isFolder should be done just once, for each file,
until next refresh is made.
Comment 1 rmatous 2005-02-08 13:25:57 UTC
/cvs/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileObject.java
new revision: 1.38; previous revision: 1.37