HFCD: Pick Your Compiler Speed! How about 10X!
In my first blog post (A New Version of HFCD) of this year, I mentioned that the latest version of HFCD, currently in beta, supports out-of-process, multi-core compilation of Flex applications and libraries for Flex/Flash Builder. I am going to present some performance results here.
As you all know, Flex/Flash Builder uses an in-process compilation strategy. If there are multiple projects in the workspace, Flex/Flash Builder will build the projects sequentially. From Flex/Flash Builder’s perspective, building sequentially is a reasonable strategy because, as a GUI application, it needs to stay responsive and that means it can not use up all the available processor resources. Unfortunately, that also means, if you use a dual-core machine, Flex/Flash Builder uses one core. If you use a quad-core machine, Flex/Flash Builder still uses one core. There is no correlation between the Flex/Flash Builder build performance and the number of processor cores in your machine.
HFCD takes a totally different approach. HFCD analyzes applications’ and libraries’ dependencies in your workspace; figures out the maximum possible concurrency level and then use all the available processors** in your machine to build. This usually results in shortened project build time.
To best illustrate this idea, let’s take a look at the demos below. The workspace consists of 8 IBM ILOG Elixir demos. These projects are independent of each other.
This is considered the best-case scenario because you can reach full CPU utilization right at the start and throughout the entire build. Now, let’s check out the performance results… The last setup is almost 10X faster than the first setup, which is currently the most common setup out there!
Setup Number of Processors Build Time Flex Builder 3, Flex 3.4.1 2 35s Flex Builder 3, Flex 3.4.1, HFCD 3 2 24s Flex Builder 3, Flex 3.4.1, HFCD 3 4 12s Flash Builder 4, Flex 4.0.0 2 12s Flash Builder 4, Flex 4.0.0, HFCD 4 2 7.7s Flash Builder 4, Flex 4.0.0, HFCD 4 4 3.9s
You can see big improvement by moving from Flex 3 to Flex 4, but that does not mean that HFCD is DOA. Instead, HFCD adds performance boost on top of Flex 4! In this scenario, HFCD makes the build run 50% faster (24s vs. 35s and 7.7s vs. 12s) by using the same hardware and 3X faster (12s vs. 35s and 3.9s vs. 12s) by doubling the number of processors!
A quick note on the performance improvement in the Flex 4 compiler. The triple-digit-percentage speed-up from Flex 3 to Flex 4 (35s vs. 12s) is likely due to the use of global LibraryCache. However, if LibraryCache is shared by bigger projects, the effect of LibraryCache will be significantly reduced.
Now, before you get too excited about the potential of multi-core compilation of Flex apps, you need to understand that the project dependencies play a key role in the build performance. For example, if your project dependency graph forms a straight line, then adding more CPUs is not going to help. If one or two projects in your workspace are dominating the total build time, consider breaking them up into smaller, independent projects.
I hope you find the test results useful…
** It is possible to configure HFCD to use less than the number of available processors. This configuration is useful for those who use quad-core machines as their development platforms by setting the concurrency level to 3 or 2.