HFCD for Flash Builder: Build Your Flex App 2-3x Faster
HFCD is an extension for Flash/Flex Builder that delegates compilation of your Flex application to a special “compiler daemon” which can run locally or on a remote machine. The goal of the project is simple: faster builds! HFCD is the brainchild of Clement Wong, the former compiler engineering lead on the Flex SDK team. Here are a few useful things to understand about HFCD:
- HF installs as a Flex Builder plugin which will delegate compilation to a separate OS-level process running either locally or on a remote machine.
- The compiler daemon process is persistent, meaning it continues to run across multiple builds. This allows the Java virtual machine to optimize compilation execution each time that a build is run. The JVM is very good at this.
- The Flex Builder plugin watches for file modifications and immediately pushes these changes to the compiler daemon process. The daemon has an internal representation of the project file system and will launch internal incremental builds automatically when files change.
So, how fast is it really? I benchmarked HFCD on two different machines. I used the Flex 3.4.1 SDK for compilation and ran clean builds of my application each time. My test project was a real-world Flex app currently in development consisting of about 15 modules and 350 MXML files and ActionScript classes.
2006 Intel Macbook Pro, Core Duo 2.16 GHz, 2 GB RAM, 7200 RPM HD, Leopard 10.5, 32-bit Java 5
- Stock: 135 seconds average
- HFCD (1st run): 155 seconds
- HFCD (successive): 75 seconds average
Intel Core i7 920 @ 3.2 GHz, HT off, 12 GB RAM, dual 7200 RPM HD’s in RAID 0, Vista 64-bit, 32-bit Java 6
- Stock: 65 seconds average
- HFCD (1st run): 52 seconds
- HCFD (successive): 21 seconds average (!!!)
As indicated in the documentation, the performance of HFCD increases dramatically after the first build due to the numerous optimizations in HellFire and the JVM itself. The Macbook was nearly 2x faster while the Windows box was just over 3x faster. Very impressive and a real time saver!
I hope to post some new benchmarks soon. I need to do some more research to get HFCD running on a 64-bit JVM as that isn’t supported out of the box. Also I’d like to configure my Macbook to delegate the compilation to my Windows box, especially to ascertain what kind impact the network topology has on build performance.