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.
Summary: | All module JAR metadata is accessed despite pnejedly's cache | ||
---|---|---|---|
Product: | platform | Reporter: | Jaroslav Tulach <jtulach> |
Component: | Module System | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | issues, jglick, jskrivanek, pnejedly |
Priority: | P2 | Keywords: | PERFORMANCE |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 199320 | ||
Bug Blocks: | |||
Attachments: | Slight improvement to work on windows |
Description
Jaroslav Tulach
2009-01-06 09:24:32 UTC
I guess it is not wise to have large discussions in IZ, so I've created a section about this problem at http://wiki.netbeans.org/FitnessViaCleanup where we can express and persist our ideas. I was not involved in writing the new cache and do not know so much about how it works and what it is expected to do, so if you have some ideas about what to improve (without breaking things), go ahead. Certainly avoiding all calls to File.isFile/isDirectory/exists on enabled JARs does not seem feasible to me; just calling File.toURI will do this! And once you have gotten File inode information, the OS very likely caches it, so I am not sure that avoiding subsequent calls on the same File gives you much actual performance benefit. If so, we could keep a simple File -> metadata cache in core somewhere which would be active just during startup. ff93758eb7eb In JarClassLoader.java, toURI(File) will be incorrect for files whose paths contain special characters (even ' '), because you are not doing URI encoding. Also remember that if the JRE's impl of File.toURI changes, your copied code will become incorrect. Anyway I think duplicating JRE code is unnecessary, since File is not final: import java.io.File; public class DisklessFile { public static void main(String[] args) { File f = new File("/tmp/non existent"); System.out.println(f.toURI()); f = new File(f.getAbsolutePath()) { public @Override File getAbsoluteFile() { return this; } public @Override boolean isDirectory() { return true; } }; System.out.println(f.toURI()); } } As to the inverse operation later on in this patch, this is also wrong, assuming that the encoding is done correctly. Just use new File(URI) which should not touch the disk AFAIK; never attempt to parse a file: URI any other way. Integrated into 'main-golden', will be available in build *200902220201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ff93758eb7eb User: Jaroslav Tulach <jtulach@netbeans.org> Log: #156330: Making sure the classes cache is really used on second start Created attachment 77556 [details]
Slight improvement to work on windows
Improved in ergonomics#d19edaf83fa9 Again, new File(URI) would be preferable to the manual URI parsing around line 750, and AFAIK does not involve any I/O operations. Integrated into 'main-golden', will be available in build *200903040201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/d19edaf83fa9 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #156330: Slight mangling with / and \ to make the cache work better on windows |