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=37184>.
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=37184

           Summary: Repeated call of macro (defined by macrodef-task) causes
                    slowing down of following processing
           Product: Ant
           Version: 1.6.5
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


Multiple calls of a macro causes performance loss in subsequent processing.

For example:

<project name="macrodeftestcase" basedir="." default="testcase">

   <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

   <property name="zipfile" value="testcase_iskv_200510191307_b.zip"/>

   <macrodef name="echotest">
      <text name="text"/>
      <sequential>
         <echo>@{text}</echo>
      </sequential>
   </macrodef>

   <target name="testcase" >

      <stopwatch name="timer0" action="start"/>
      <antcall target="zip_ant_home"/>
      <stopwatch name="timer0" action="stop"/>

      <echotest>Hello world 0</echotest>
      <echotest>Hello world 1</echotest>
      <echotest>Hello world 2</echotest>
      <echotest>Hello world 3</echotest>
      <echotest>Hello world 4</echotest>

      .......

      <echotest>Hello world 2999</echotest>
      <echotest>Hello world 3000</echotest>

      <stopwatch name="timer1" action="start"/>
      <antcall target="zip_ant_home"/>
      <stopwatch name="timer1" action="stop"/>

      <stopwatch name="timer0" action="total"/>
      <stopwatch name="timer1" action="total"/>   

   </target>

   <target name="zip_ant_home">

      <delete file="${zipfile}"/>
      <zip destfile="${zipfile}" basedir="${ant.home}"/>

   </target>

</project>

Result of target "testcase" could be:

D:\macrodeftestcase>ant -cp ant-contrib.jar
Buildfile: build.xml

testcase:

zip_ant_home:
   [delete] Deleting: D:\macrodeftestcase\testcase_iskv_200510191307_b.zip
      [zip] Building zip: D:\macrodeftestcase\testcase_iskv_200510191307_b.zip
     [echo] Hello world 0
     [echo] Hello world 1
     [echo] Hello world 2
     [echo] Hello world 3
     [echo] Hello world 4
     [echo] Hello world 5
     [echo] Hello world 6
     [echo] Hello world 7

     ...........

     [echo] Hello world 2998
     [echo] Hello world 2999
     [echo] Hello world 3000

zip_ant_home:
   [delete] Deleting: D:\macrodeftestcase\testcase_iskv_200510191307_b.zip
      [zip] Building zip: D:\macrodeftestcase\testcase_iskv_200510191307_b.zip
[stopwatch] [timer0: 6.312 sec]
[stopwatch] [timer1: 10.609 sec]

BUILD SUCCESSFUL

For more complex macros (e.g. with an for-task, which uses macrodef internally)
significant performance loss can occur after a very much smaller number of 
macro calls.

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to