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()…
[Tue Sep 29 15:08:53 EDT 2009] compile() result=1 time=14314
[Tue Sep 29 15:09:07 EDT 2009] link() size=1515458 time=543
[Tue Sep 29 15:09:26 EDT 2009] compile() result=1 time=12243
[Tue Sep 29 15:09:38 EDT 2009] link() size=1515449 time=490
[Tue Sep 29 15:09:46 EDT 2009] compile() result=1 time=11215
[Tue Sep 29 15:09:57 EDT 2009] link() size=1515458 time=587
[Tue Sep 29 15:10:12 EDT 2009] compile() result=1 time=11694
[Tue Sep 29 15:10:24 EDT 2009] link() size=1515446 time=441
[Tue Sep 29 15:10:50 EDT 2009] compile() result=1 time=10842
[Tue Sep 29 15:11:01 EDT 2009] link() size=1515453 time=522
In my opinion, the performance improvement is not framework-specific, but likely for mid-to-large-sized projects in general.