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.
InstallFileLocaterImpl.java: Too many calls to FileUtil.normalizeFile() even when results are never used.
Created attachment 56999 [details] InstalledFileLocatorImpl.makeFile() -- method calls
Created attachment 57001 [details] Old callers - full stacks
Created attachment 57003 [details] Suggested patch
Created attachment 57004 [details] Results when patch applied
File.isDirectory() invocations from InstalledFileLocatorImpl.java summary: trunk: 7467 invocations patch: 2069 invocations Environment: custom build, jdk1.6.0_04. Steps: 1. start IDE with existing user-dir, 2. wait a minute, 3. shutdown IDE. user-dir was created, but no activity was done in IDE.
Imho it should be enough to convert dirs[i] = FileUtil.normalizeFile(dirs[i]) and then just skip any further normalizations. As far as I understand the concept of normalizeFile, this should still behave as expected and it would decrease the number from 2000 to some small constant ~ 10. Jesse and Nejedlaku, can we do such change?
Yes, I think that would be an easy and safe optimization.
I would think so too, normalize doesn't follow symlinks. But make sure ".." is documented forbidden then, you might be changing the behavior slightly otherwise.
Exactly, '../' sequences should be forbidden. I hope no one was using them to begin with.
Fixed in trunk, changeset aa562c6e76b5
Perfect. Now something similar for JarClassLoader, please ;-)
One additional improvement imho, is to make sure this test will not be unnoticeably affected by changes in Java VM. Because it might happen that the calls change and the isDirectory will no longer be 3rd element on the stack. In such case we shall update the test, otherwise it stops measure anything. One way to do it, is to verify that the counter is incremented at least few times, eg. > 0.