ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 42259] New: - Class loading speed can simply be improved in AntClassLoader.java
Date Thu, 26 Apr 2007 08:51:19 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42259>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42259

           Summary: Class loading speed can simply be improved in
                    AntClassLoader.java
           Product: Ant
           Version: 1.7.0
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: tom.brus@nl.compuware.com


As send earlier on the mailing list:

We have a lot of classes that are loaded by the AntClassLoader. From performance
measurements I noticed that a lot of time was spend in
File.exists() during class loading. I checked the code and noticed that
in:

     InputStream getResourceStream  (File file, String resourceName);

and in

     URL         getResourceURL     (File file, String resourceName);

The following check is done first:

     if (!file.exists()) {
         return null;
     }

This seems smart, because if the file does not exist the answer is clear. Unless
of course 'exists()' is slow; which it turns out to be (on Windows at least). A
considerable improvement can be accomplished by first checking the 'zipFiles'
Hashtable: if "zipFiles.get(file)" returns non-null we can be sure that the file
exists and that it is not a directory. Remember that most calls will be for a
jar file that has already been opened. So those expensive (compared to
Hashtable.get()) tests on File can be skipped most of the time.

One of our test runs was reduced by 1/3 in runtime by a quick patch I made (it
loads thousands of classes...).

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message