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.
The Search feature currently initializes a DataObject for each file it searches. This is time and memory consuming for many DataObject types and it is not necessary to do so. It would be better to search just FileObjects and initialize DataObjects only for FileObjects matching the search criteria.
Hi Guys, We have ~5,000 source files. When we do a search on the source files in Solaris Netbeans 6.1 is taking > 10 minutes. The second time we do this search it takes a few seconds. The time is all in Netbeans as when we close open the IDE it's very slow again to do a search. A *find/grep *from the command line is fast. We also find opening a folder in the IDE is slow ( seconds) What is netbeans doing when we open a folder and is there a way to stop it ? Thanks,
I find this problem very troublesome too. Netbeans is almost unusable for me - On monday morning after our weekly reboot, the first thing I do is do a search over all of our files which can take about 45 mins. If I do this, initial search, subsequent searches seem to be faster afterwards. Still the 1 off 45mins is alot of wasted time & even after, the search speed is very very slow
Why is this an enhancement, not a defect? From the symptoms the users face it sounds like this should be a defect.
Changed the status to "defect".
We aren't able to use the NB search at all as our ~5,000 source files are stored on a NFS mount ( mandatory, sorry) see #144131 for more details. The command line below runs in seconds :- find . -name "*.java" -exec grep "ABC" {} \; Also other IDEs search the sources quickly.
Created attachment 75268 [details] Patch changing the Search mechanism to use FileObject's to search instead of DataObject's
Since the following API was changed reassign for API review: - Added public interface SearchInfo.Files - Utils class made public with one public static method
BTW true Hg patches are generally preferred: http://wiki.netbeans.org/HgHowTos#section-HgHowTos-DevelopAPIReviewPatchesUsingMQ [JG01] Using FileObject (rather than File) has some overhead, too, though likely a lot less than DataObject adds. Have you measured NB's time with FileObject (on a cold disk) and compared to command-line find/grep? What about when using File? [JG02] SearchInfo.Files missing class Javadoc. Also be sure to add @since and apichanges.xml entry. Same for Utils. [JG03] DataObject.getChildren automatically sorts files, usually by name. Probably you want to do the same manually when working at the FileObject level. Otherwise search results will appear in unpredictable order.
Created attachment 75772 [details] Revised patch
JG01: I am afraid we can't use File instead of FileObject mainly because we need to know charset to read file correctly. As for comparing performance with command-line find tools I have not measured it. JG02: Done in the revised patch. JG03: I plan to implement sorting result functionality on the result model side (issue 119818). It allows us to sort all search results together instead of only for each folder level. Also by this way we can implement different sorting functions and add UI to allow user to use it. So I think it will be overhead to do sorting on the FileObject level.
Y01 I do not see a single line of test in the patch. Please cover the API with a testcase. Especially the CompoundIterators semantics deserve some stiffening with a test, imho.
Created attachment 75996 [details] Revised patch
In the revised patch 2 tests for the new API were added and others were fixed.
Y02 Add private constructor to Utils class. Otherwise OK, I guess.
Y02: Will do before pushing the changes into repository.
I will integrate the last patch plus changes for Y02 in 24h.
Fixed in the trunk.
Integrated into 'main-golden', will be available in build *200901241401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/4396d95a883f User: Andrey Yamkovoy <kaktus@netbeans.org> Log: Fix for #134558 - Search FileObjects, not DataObjects