How JVM Settings Affect the Flex Compiler Performance

Many of you who build medium to large-sized Flex projects with Flex Builder know that you need to modify the memory settings of the JVM in FlexBuilder.ini. For example, my JVM settings in FlexBuilder.ini look like this:

-Xms512m -Xmx1024m -XX:MaxPermSize=256m -XX:PermSize=64m

Other than having bigger -Xms and -Xmx values, it’s exactly the same as the default setting. The Flex Builder team did not arbitrarily set these values. They did not set the values for the compiler only. They set the values so that all the features in FB achieve optimal performance.

One of the arguments of using HFCD is that if you run the compiler out-of-process, you get a chance to configure the JVM for the compiler only. The HFCD installation only puts in the following default setting:

-Xms512m -Xmx1024m -XX:+UseParNewGC

I take the minimalist approach here because I want to give the HotSpot VM maximum flexibility to do its own tuning at runtime. So, does this HFCD out-of-process-compilation argument make sense? Well, let’s take a look at using Flex Builder to compile the Flex framework (a 800-file project).

My machine is a MacBookPro with dual-core 2.4GHz and 2GB of memory. The default Java setting is Java 6 64-bit.

Flex Builder spends consistently (in several full builds) about 15 seconds to compile the Flex framework in-memory. When Flex Builder uses HFCD to compile the Flex framework out-of-process (throw away the first warm-up build), HFCD initially compiles in 15 seconds and then gradually improves to about 11 seconds. That’s 25% faster! The following is my HFCD log. Note that the time is in milliseconds and build time = compile() + link()…