yesh
yesh

Reputation: 2070

How can I speed up MXMLC compiles?

I am using ant to build my web application. I have a target in my ant script which takes approximately 8 minutes to compile. Since mxmlc compiles everything from scratch and loads up the JVM each time, it is taking a lot of time. Is there a way to optimize this task?

I am using Flex SDK 3.0. Here is my ant target:

<target name="compile.organic.flash" depends="setup">
  <property name="WelcomeBack.swf" value="${www.dir}/swf/as3/apps/welcome/WelcomeBack.swf" />
  <mxmlc file="${AS3.classpath}/com/organic/app/fthb/welcome/src/WelcomeBack.as"
         output="${WelcomeBack.swf}"
         incremental="${mxmlc.inc}"
         default-frame-rate="30"
         accessible="true"
         default-background-color="${swf.backgrond.color}"
         allow-source-path-overlap="true"
         compiler.strict="true">
    <default-size width="940" height="528" />
    <source-path path-element="${Welcome.path}"/>
    <source-path path-element="${AS3.classpath}"/>
  </mxmlc>

  <property name="Welcome.swf" value="${www.dir}/swf/as3/apps/welcome/Welcome.swf" />
  <mxmlc file="${AS3.classpath}/com/organic/app/fthb/welcome/src/Welcome.as"
         output="${Welcome.swf}"
         incremental="${mxmlc.inc}"
         default-frame-rate="30"
         accessible="true"
         default-background-color="${swf.backgrond.color}"
         allow-source-path-overlap="true"
         compiler.strict="true">
    <default-size width="940" height="528" />
    <source-path path-element="${Welcome.path}"/>
    <source-path path-element="${AS3.classpath}"/>
    <compiler.include-libraries dir="${AS3.component}/" >
    </compiler.include-libraries>
  </mxmlc>

  <property name="App.swf" value="${www.dir}/swf/as3/apps/App-${svnVersion}.swf" />
  <mxmlc file="${AS3.classpath}/com/organic/app/fthb/App.as"
         output="${App.swf}"
         incremental="${mxmlc.inc}"
         default-frame-rate="30"
         default-background-color="${swf.backgrond.color}"
         compiler.strict="true">
    <default-size width="300" height="300" />
    <source-path path-element="${AS3.classpath}"/>
    <compiler.include-libraries dir="${AS3.component}/" >
    </compiler.include-libraries>
  </mxmlc>

  <property name="LSOApp.swf" value="${www.dir}/swf/as3/apps/LSOApp-${svnVersion}.swf" />
  <mxmlc file="${AS3.classpath}/com/organic/boa/fthb/LSOApp.as"
         output="${LSOApp.swf}"
         incremental="${mxmlc.inc}"
         default-frame-rate="30"
         default-background-color="${swf.backgrond.color}"
         compiler.strict="true">
    <default-size width="300" height="300" />
    <source-path path-element="${AS3.classpath}"/>
    <compiler.include-libraries dir="${AS3.component}/" >
    </compiler.include-libraries>
  </mxmlc>

  <property name="CheckRates.swf" value="${www.dir}/swf/as3/apps/CheckRates-${svnVersion}.swf" />
  <mxmlc file="${CheckRates.path}/CheckRates.as"
         output="${CheckRates.swf}"
         incremental="${mxmlc.inc}"
         default-frame-rate="40"
         accessible="true"
         default-background-color="${swf.backgrond.color}"
         compiler.strict="true" compiler.allow-source-path-overlap="true" >
    <default-size width="940" height="528" />
    <compiler.source-path path-element="${AS3.classpath}"/>
    <compiler.source-path path-element="${CheckRates.path}"/>
    <!--  <source-path path-element="${AS3.classpath}"/> -->
    <compiler.include-libraries dir="${AS3.classpath}">
    <include name="fl/fl.swc" />
    </compiler.include-libraries>
  </mxmlc>

  <copy file="${AS3.classpath}/com/organic/app/fthb/checkRates/js/config/check_rates_config.js" tofile="${www.dir}/swf/as3/apps/config/check_rates_config.js"/>
  <property name="PointsCalculator.swf" value="${www.dir}/swf/as3/apps/PointsCalculator-${svnVersion}.swf" />
  <property name="flash.apps.build.dir" value="${www.dir}/swf/as3/apps" />
  <compile-flash basename="PointsCalculator" srcdir="${flash.apps.src.dir}/pointsCalculator">
  </compile-flash>
  <copy todir="${flash.apps.build.dir}/config">
    <fileset dir="${flash.apps.src.dir}/pointsCalculator/config" includes="*.js"/>
  </copy>
  <copy todir="${build.dir}/www/css">
    <fileset dir="${flash.apps.src.dir}/pointsCalculator/css" includes="*.css"/>
  </copy>
  <copy todir="${build.dir}/www/swf/as3/apps/welcome/assets/swfs">
    <fileset dir="${flash.apps.src.dir}/welcome/assets/swfs" includes="*.swf"/>
  </copy>
  <copy file="${videoplayer.dir}/videoplayer.swf" tofile="${www.dir}/swf/as3/apps/videoplayer.swf" />
</target>

Upvotes: 2

Views: 1958

Answers (2)

keyle
keyle

Reputation: 2837

We found that what was slowing down the compiler was mostly linking assets. We made a library project swf that is just used for assets (images, swfs, etc.) except fonts, and it works a treat.

We have a massive project building under 2 mins from maven.

Upvotes: 0

NoobsArePeople2
NoobsArePeople2

Reputation: 1996

Use fcsh. From the first paragraph of that link

The fcsh (Flex Compiler Shell) utility provides a shell environment that you use to compile Flex applications, modules, and component libraries. It works very similarly to the mxmlc and compc command line compilers, but it compiles faster than the mxmlc and compc command-line compilers. One reason is that by keeping everything in memory, fcsh eliminates the overhead of launching the JVM and loading the compiler classes. Another reason is that compilation results (for example, type information) can be kept in memory for subsequent compilations.

Upvotes: 1

Related Questions