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.
File.normalize() is an expensive call and if we do it during every FileUtil.toFileObject(). Although we declare that IAE is thrown if not normalized file is passed as an argument we should make our best effort to avoid these calls. Probably the check should be performed as assert. Part of reason why this is slow is that it directly accesses I/O using calls like File.isDirectory().
Raising priority to P2. It might need API change but it is desirable to do it for 5.0. Even the initial intent was to assure that correct args are passed during development. That's really a job for assertion.
Created attachment 26315 [details] diff - request for API review + apichanges.xml
FileUtil.toFileObject won't throw IllegalArgumentException anymore. More info in attachment.
1. You left the "throws IAE" in the method signature. 2. I don't think an assertion is appropriate here, for the usual reasons - never use assertions to check args on public methods. However I might suggest boolean asserts = false; assert asserts = true; if (asserts && !file.equals(normalizeFile(file))) { throw new IllegalArgumentException(...); } This would still make sure we catch errors in dev builds, but yield better performance in release builds. (We *do* measure performance with assertions disabled, right...?)
Created attachment 26323 [details] OK - reworked
Obviously +1 from me to integrate the patch :-) To Jesse: yes, we replace netbeans.conf for performance testing to use the same set of switches as you plan for release.
Will be integrated.
/cvs/openide/fs/apichanges.xml,v <-- apichanges.xml new revision: 1.5; previous revision: 1.4 /cvs/openide/fs/src/org/openide/filesystems/FileUtil.java,v <-- FileUtil.java new revision: 1.11; previous revision: 1.10
This issue had *1 votes* before move to platform component