You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/02/03 20:43:48 UTC
DO NOT REPLY [Bug 19101] Project.fireMessageLoggedEvent performance
fix
https://issues.apache.org/bugzilla/show_bug.cgi?id=19101
--- Comment #5 from Xiaoming Shi <xi...@cs.wisc.edu> 2011-02-03 14:43:42 EST ---
Hi dude,
I find that in the latest version of ANT, another place has the same problem
./apache-ant-1.8.2/src/main/org/apache/tools/ant/Main.java line:862
(In reply to comment #0)
> In trying to speed up my builds, I ran ant with the -Xprof option to see what
> what slow. According to the profiler, an inordinate amount of time was being
> spent in Vector.size(). The profiler also showed that
> Project.fireMessageLoggedEvent() was chewing up a lot of time, so I started
> looking there.
>
> It turns out a simple optimization sped up my build from 1:45 to 1:30 (about
> 15%). The optimization is to pull the call to listeners.size() out of the loop.
>
> From this:
>
> loggingMessage = true;
> for (int i = 0; i < listeners.size(); i++) {
> BuildListener listener = (BuildListener) listeners.elementAt(i);
>
> To this:
>
> loggingMessage = true;
> int size = listeners.size();
> for (int i = 0; i < size; i++) {
> BuildListener listener = (BuildListener) listeners.elementAt(i);
>
>
> It's not a huge speedup (about 15%) but it makes a difference.
>
> I'm using Ant 1.5.3-1 (compiled from source, obviously) on a 1ghz Powerbook
> running OS X 10.2.5 and JDK 1.4.1. My build doesn't have any custom build
> listeners, just the default.
>
> If this fix can't be implemented for some reason, please leave this bug open -
> IMHO this is a defect that needs to be fixed.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.