Stop Coding!

The Unofficial Flex Compiler Blog

Posts Tagged ‘Flex

HFCD 4 Is Now Officially Available.

Hi, I’m pleased to announce that HFCD 4 is now officially available.

HFCD 4 for Flash Builder achieves better Flex (full and incremental) build performance than Flex 3 and Flex 4 by utilizing:

  1. all of the Flex 4 compiler performance improvements
  2. multicore processor technology
  3. techniques to build Flex apps in the background.

and allows builds to be distributed to multiple machines on a local network. The HFCD ant tasks also make it easy to integrate HFCD with custom build systems or popular build systems like Hudson CI, etc.

To learn more about HFCD, please visit

Those who purchased HFCD 3 before today will receive their FREE copies of HFCD 4. Sorry, this special offer ends today.

But don’t be disappointed. If you find a HFCD bug and file it and I can reproduce it, you will get a HFCD license for free. Click here for details. The offer ends by the end of this month (2010/04) but I’m going to extend it until further notice…

Download HFCD:


HFCD: File A Bug Report And Get A License For FREE!

HFCD 4 beta period is going to end and it will be officially released very soon. In order to make HFCD as stable as possible before the finish line, I would like to ask for more participations. If you file a HFCD bug report this month (April, 2010) [Update (2010/04/26) This offer will continue after April, 2010… until further notice) and I can reproduce the bug, you will get a HFCD license for free!

Here are the rules. You must:

  1. File against the latest HFCD build.
  2. Use the online Bug Report Submission Form.
  3. Include a detailed bug description, steps to reproduce and a Flash Builder project test case.

If multiple bug reports are filed against the same issue, only the first submitter will receive a HFCD license.

Rules are subject to change without notice.

Written by Clement Wong

April 14, 2010 at 11:49 am

More On The Incredible Shrinking JVM Heap…

with 4 comments

In the previous post, I talked about the unusual phenomenon of seeing JVM shrink its heap and returning unused memory back to the operating system when running HFCD. But I didn’t talk much about how it happened. This post is to follow up on that…

First of all, the two key JVM parameters responsible for resizing JVM heap are:

  • -XX:MinHeapFreeRatio (default is 40)
  • -XX:MaxHeapFreeRatio (default is 70)

According to Sun (now Oracle),

By default, the virtual machine grows or shrinks the heap at each collection to try to keep the proportion of free space to live objects at each collection within a specific range. This target range is set as a percentage by the parameters -XX:MinHeapFreeRatio=<minimum> and -XX:MaxHeapFreeRatio=<maximum>, and the total size is bounded below by -Xms and above by -Xmx .

It goes on to say:

With these parameters if the percent of free space in a generation falls below 40%, the size of the generation will be expanded so as to have 40% of the space free, assuming the size of the generation has not already reached its limit. Similarly, if the percent of free space exceeds 70%, the size of the generation will be shrunk so as to have only 70% of the space free as long as shrinking the generation does not decrease it below the minimum size of the generation.

Both Flash Builder and HFCD use the default -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio setting. As a matter of fact, by default, HFCD only sets -Xmx1024m and lets JVM tune itself.

Now take a look at the heap usage of Flash Builder when running the compiler internally. It looks obvious that the requirement for -XX:MaxHeapFreeRatio is not met. Therefore, no shrinking.

But take a look a the heap usage of HFCD. The used heap (blue line) drops so much (i.e. free space well exceeds 70% at the end) that JVM is able to resize the heap downward based on the default -XX:MaxHeapFreeRatio setting.

I also tried -server (HotSpot Server VM) and -client (HotSpot Client VM) on HFCD and manage to get the downward heap resizing to kick in.

However, there are two caveats you need to know:

  1. By default, JVM uses serial GC. If you start JVM by using the parallel GC (i.e. -XX:+UseParallelGC), you will NOT see this kind of huge downward resizing. I could be wrong but I think it’s because the parallel GC uses the adaptive size policy to control the size of the generations and ignore the -XX:MaxHeapFreeRatio setting.
  2. The charts above were generated by running Java 5/6 on Windows. The JVM on Mac OSX does adjust heap size downward from time to time but they are all very minor downward adjustments and it does not do that major downward resizing after finishing a full build.

There you go.

Written by Clement Wong

April 12, 2010 at 11:21 am

Coming Soon: Ant Tasks for HFCD

with 2 comments

Since the last update, I’ve been working on bugs and of the many bugs I fixed, 4 of them are critical enough that I think I should update HFCD again this weekend. One of them has been around forever and the rest of them are Windows-related (I really should spend more time on Windows!).

Also, I’ve been working on some Ant tasks for HFCD. The testing is almost done so I think they are likely to be included in the next HFCD update.

So, what it’s like in build.xml? Take a look:

<project name="MyProject" default="main" basedir=".">
    <taskdef name="hfcd" classname=""/>
    <property name="helloworld.dir" value="${basedir}/helloworld"/>
    <property name="myLib.dir" value="${basedir}/myLib"/>
    <target name="main">
                <fileset dir="${basedir}" includes="**/*">
                    <exclude name="build.hfcd/**/*"/>
                    <exclude name="apps/**/*"/>
                    <exclude name="libs/**/*"/>
                    <exclude name="build.xml"/>
            <application id="helloworld" depends="myLib"
                    description="Building apps/helloworld.swf">
                <fileset file="${helloworld.dir}/src/helloworld.mxml"/>
                    -library-path "${basedir}/libs/myLib.swc"
            <library id="myLib" output="${basedir}/libs/myLib.swc">
                    <fileset file="${myLib.dir}/src/com/foo/"/>
                    -source-path "${myLib.dir}/src"
    <target name="clean">
        <delete file="${basedir}/apps/helloworld.swf" />
        <delete file="${basedir}/libs/myLib.swc" />
        <hfcd clean="true" />

Don’t worry about the syntax. Once it’s out there, I’ll blog about it in more details.

What’s cool about this is that you can now hook up HFCD with your favorite Flex IDE (as long as your favorite IDE supports Apache Ant)!

Written by Clement Wong

December 16, 2009 at 6:21 pm

HFCD 3/4 Installers for Mac OS X, Windows and Linux Now Available

with 14 comments

I want to get this out before the US Thanksgiving long weekend. After offering only Mac installer for a month, the HFCD 3/4 Windows and Linux installers are also available. As usual, you can download HFCD here:



Before this HFCD update, you were required to register in order to download. Now the registration is optional. Yipee!

The trial period is now extended to February, 2010. It is longer than the usual 1-month trial period because it sounds like a bad idea for the trial period to end right after the New Year celebration…

I will likely have a couple more updates in the next two months… I was asked about fcsh and ant support, so I really want to look into it.

Written by Clement Wong

November 25, 2009 at 5:02 pm

Running HFCD on a multi-CPU server

with one comment

I’ve been asked several times about this: Suppose I have a quad-core or 8-core server with lots of RAM. Can this machine run multiple instances of HFCD, each of which serves an instance of Flex Builder running on a ‘slow’ laptop on the same LAN?

I think the answer is yes… though someone has to do a field test for me. One little-known (or I should say undocumented) feature is that you can specify the admin and compiler port numbers on the command line when you start hfcd.

> ./hfcd

By default, it uses port 50207 and 50208. You can specify two different numbers like this:

> ./hfcd 50210 50211

Now, say if you want to start 4 instances of HFCD on your multi-CPU server, you can do:

> ./hfcd 50201 50202 &
> ./hfcd 50203 50204 &
> ./hfcd 50205 50206 &
> ./hfcd 50207 50208 &

Of course, you want to make sure that the combined value of the -Xmx setting of all instances is less than the amount of physical memory on that machine.

The next step is to adjust the IP address and port numbers in Flex Builder. In Flex Builder, simply click Preferences –> HellFire Compiler; change the address and port numbers and restart FB.

Now you may be wondering why several developers want to share one fast machine to compile Flex apps. Well, the key question is: how much time each developer would take from the machine to compile during a say, 8-hour work day and how frequent these developers send the compile requests to the machine? Do they all do it at or about the same time throughout the day? If the ‘collision’ rate is low on any given work day, the effect would be like each developer having exclusive access to the CPU resources. That’s obviously a lot better than the ‘local-HFCD’ scenario.

Written by Clement Wong

November 25, 2009 at 4:27 pm

How To Setup Your Projects for HFCD

with 8 comments

Howdy, some developers are having difficulties setting up their Flex Builder projects to use HFCD. I hope to address this by producing more documentation in the coming weeks. In the meantime, I hope to use the following example to explain how to setup your projects for HFCD. It should be pretty straightforward…

This example uses one of the IBM ILOG Elixir samples, heatmap.

1. Assume that you have ILOG Elixir installed (e.g. /Applications/IBM/ILOG/Elixir 2.5). In Flex Builder, import “Existing Projects into Workspace”. Select /Applications/IBM/ILOG/Elixir 2.5/samples/heatmap. Check “Copy projects into workspace”.


2. Once the project is loaded, you should see in the HFCD console window that the heatmap project files are being ‘uploaded’ to HFCD.

[Thu Oct 22 12:40:12 EDT 2009] upload() count=2 total=541 time=1
[Thu Oct 22 12:40:12 EDT 2009] upload() count=74 total=1624755 time=66

Also, check out the project properties. Please take a look at ‘Flex Build Path’. You should see ilog-elixir.swc and ilog-elixir_rb.swc in the library path.


3. The SWC files are in /Applications/IBM/ILOG/Elixir 2.5/frameworks. But the heatmap project that you’ve just imported is in, e.g. in my case, /Users/clement/Documents/Flex Builder 3/elixir-sample-heatmap. The SWC files are explicitly specified and are not managed by the Eclipse resource manager. That means, HFCD would not know about them. In fact, any files that the project workspace does not know about would not be “uploaded” to HFCD. To address this issue, you can use the “HFCD FileSet” view.


4. Click ‘Windows’ –> ‘Other Views…’ and you should see the “HFCD FileSet’ view at the bottom. There is a pull-down menu at the top-right corner (that little inverted triangle) of the “HFCD FileSet” view. Click the pull-down menu and select ‘Add Directory’.


5. Add /Applications/IBM/ILOG/Elixir 2.5/frameworks to the “HFCD FileSet” view.


6. Go back to the pull-down menu and select “Upload Files”. This step “uploads” the SWC files to HFCD.

[Thu Oct 22 12:45:32 EDT 2009] upload() count=2 total=2486244 time=52
[Thu Oct 22 12:45:32 EDT 2009] upload() count=2 total=16330 time=2
[Thu Oct 22 12:45:32 EDT 2009] upload() count=2 total=14402 time=2
[Thu Oct 22 12:45:32 EDT 2009] upload() count=3 total=0 time=0
[Thu Oct 22 12:45:32 EDT 2009] upload() count=2 total=694230 time=14
[Thu Oct 22 12:45:32 EDT 2009] upload() count=4 total=0 time=0

The “HFCD FileSet” view will then show the number of files being “uploaded”.


Behind the scene, the files in /Users/clement/Flex Builder 3/elixir-sample-heatmap and /Applications/IBM/ILOG/Elixir 2.5/frameworks are copied to /Users/clement/.hfcd/files. It is where HFCD locates and compiles the files.

7. At this point, HFCD should have all the files it needs to compile heatmap. Now, start a new, clean build.


8. If there is nothing wrong, the heatmap app will be compiled successfully and you should see it in the “HFCD View” view.


9. Test the app by selecting ‘heatmap.html’ in the ‘bin-debug’ directory.


Hope you find this useful. Also, this previous post ( talks about the very same topic. Please check it out.

Written by Clement Wong

October 22, 2009 at 3:19 pm