DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21296>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21296

Some peephole optimizations

           Summary: Some peephole optimizations
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


At least according to OptimizeIt, Ant doing an empty incremental build (i.e.
nothing actually needs to be done but it doesn't know that yet) seems to spend a
bunch of time matching paths, which is relatively concentrated code that should
be optimizable. SelectorUtils methods in particular seemed to be called heavily
- tokenizePath(String), and match(String,String,boolean).

Try this patch; at least for me it seems to shave off a few percent from the
user CPU usage. Tested on NetBeans sources, script nbbuild/build.xml, target
all-web/advanced - this builds many subprojects, each of which typically runs
<javac> and <jar> and a couple of other things.

I tried to use Collections classes in place of Hashtable + Vector, maybe saving
a little bit of useless synchronization. (If Ant sources can indeed assume JDK
1.2 now, there seems little reason to use the older and slower classes.)

Ant also seems to waste a bunch of time cloning AntTypeDefinition's if you have
a lot of subprojects, and generally copying every attribute and definition from
the parent project to the child. Probably this kind of thing could be made
lighter weight with an inheritance or copy-on-write model for the subproject,
since typically the subproject will only define a few more properties and maybe
a couple of tasks. But that is a potentially bigger code change that I didn't
want to get into. Especially given the potential for breaking some rarely-used
API contract relating to mutability or identity of some Hashtable returned from
some method on Project etc.

Project also wastes some time & memory cloning its Vector of buildListeners
every time it logs a message, which seems silly. Not even sure why any of that
is synchronized at all, unless <parallel> relies on it.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to