September 20, 2005
Updates and Carrot Cake
It didn't take too long for me to have a languishing blog. I do have half of my thoughts written down for a post on the proxy, but it might be a week or two before I finish them. So this will have to do for a quick grab-bag post.
I haven't had too much time lately, and all of us working on Flex have been hard at work lately. Those on the flexcoders mailing list have probably noticed the decrease in posts from us. Ok, so I'll let you in why we've all been so busy lately... we're baking everyone a cake, a big carrot cake. No, we're just all hard at work for the next release.
If you read this blog from MXNA, which I'm guessing many people do, you already know that IFBIN has launched a new site. I wanted to mention it anyways, though, since I've enjoyed watching the examples pile up there.
I'm glad so many people have gotten use out of my FastMxmlc fix. From what I hear, this may soon become an official patch through a technote. I wish I could provide really helpful fixes like this all the time, but I should warn everyone that this is the only fix I have up my sleeve. I have other new things to show, though, and perhaps I will find another gem like that in my investigations.
Posted by Brian at 10:51 PMSeptember 5, 2005
Speeding Up Mxmlc
Since this page is still very popular, I want to make clear that the change described below is for Flex 1.5 and does not work in Flex 2. The Java class for mxmlc in Flex 2 is "flex2.tools.Compiler", and Flex 2 has something like FastMxmlc built-in with the "incremental" compiler parameter.
A few weeks ago I posted on flexcoders my thoughts on how to speed up compilations from the command-line. At the end of the post there was one unanswered question in my mind- why didn't class caching work from the command-line? Class caching, aka SWO caching, is a way to speed up compilations by storing information on classes between compiles. This should work by default, but for a simple reason this was only working when compiling from the web and not when running mxmlc. Since I wrote the SWO caching code, I was quite certain there wasn't a good reason for this not to be running, and since there was a simple way to turn this on without actually touching Flex code, I created a class that did this to provide to others. This code is not supported by Macromedia, your mileage may vary, etc.
You can download here a jar file that contains one class, flex.tools.FastMxmlc. I've found using FastMxmlc speeds up compilations anywhere from 5% to 200%. This speedup only comes when you have a lot of classes that haven't changed after a previous compilation. It also depends on how many classes you have. If you have more than a couple hundred classes, you could see more than a 200% increase.
The code in FastMxmlc is really trivial, and only has more than three lines in the main method because of a workaround needed to give the right error status on System.exit(). Because of this workaround, you do need to always specify the output file via "-o". Other than that, everything will work just as it does in mxmlc.
Here's a sample Ant snippet for using this jar:
<!-- location of webroot (and flexlib) -->
<property name="compile.webroot" value="apps/dev.war" />
<property name="compile.flexlib" value="${compile.webroot}/WEB-INF/flex" />
<!-- the file to compile -->
<property name="compile.file" value="${compile.webroot}/checkinTest.mxml" />
<!-- location for SWF -->
<property name="compile.swfloc" value="${compile.webroot}/checkinTest.swf" />
<!-- location of fastmxmlc.jar -->
<property name="compile.fastmxmlc"
value="${compile.flexlib}/lib/fastmxmlc.jar" />
<!-- compile using FastMxmlc, a simple wrapper over flex.tools.Mxmlc -->
<java classname="flex.tools.FastMxmlc" fork="true" failonerror="true">
<classpath>
<pathelement location="${compile.fastmxmlc}"/>
<fileset dir="${compile.webroot}/WEB-INF/lib" includes="*.jar" />
<fileset dir="${compile.flexlib}/jars" includes="*.jar" />
</classpath>
<jvmarg line="-Xms32m -Xmx768m -Dsun.io.useCanonCaches=false"/>
<arg line="-o ${compile.swfloc} -flexlib '${compile.flexlib}'
-configuration ${compile.flexlib}/flex-config.xml
-webroot ${compile.webroot} ${compile.file}" />
</java>
And now the summary, for those who skimmed the above: you can download here a jar file that contains the class flex.tools.FastMxmlc, a simple wrapper over flex.tools.Mxmlc. This is not a Macromedia-supported jar, but you can try it out for speeding up your command-line compilations. Enjoy!
Posted by Brian at 1:38 PMHello world
Welcome to my home for occasional thoughts on Flex. I'm Brian Deitte, and after working on application servers for five years, I thought it was time for deitte.com to be more than an email address.
I've been working on Allaire/Macromedia servers for quite awhile- two years on JRun and its servlet engine, a year tuning ColdFusion and CFCs, and nearly two years working on Flex and RemoteObject, the proxy, compc, and now the compiler in general.
I can't talk about what I've been doing lately, the great amount of work being done for 2.0, but I do have a few things I'd still like to share about Flex 1.x if I can find the time- information on a faster mxmlc that should appear shortly, an apologia for the proxy, and some thoughts on developing on unsupported platforms.
I've already read so many interesting things on Flex in blogland- Matt's early, where-the-hell-does-he-find-the-time posts, the neat IFRAME trick from Christophe, Scott's posts on CF and Flex, the ideas for building better RIAs from Sho, and of course much from the hard-drinking, hard-working folks at iteration::two. I can't promise anything like the above, but I should bring a few new Flex ideas into the mix. And yes this domain still serves its original purpose, as a permanent email home for me- you can contact me at brian (at deitte.com).
Posted by Brian at 12:34 AM

