Facebook speeds up its open-source Buck app build tool
With millions of mobile apps in the Google Play and Apple Inc. app stores, it would seem that creating them is a snap. But one part of the app creation process is anything but quick and easy: compilation, which is the process of turning translating code into language machines can read. As a result, software developers spend a lot of time simply waiting for the computer to get through this process.
Facebook Inc. has been working on making compilation faster at least since 2013, when it made Buck, a so-called build tool it created in 2012 to speed up compilation and running of Android and later iOS apps, available in open source. Today, it’s also open-sourcing several new improvements to Buck that vastly speed up compilation of Java code.
Jonathan Keljo, the Facebook senior software engineer who worked on the changes, told SiliconANGLE that the team was looking to get more than incremental improvements out of the tool. “We took a step back and questioned some of the core assumptions about Java,” the programming language used in creating apps, he said.
Three of the changes involve the compilation process, which in Buck involves many small modules of code that can be created and processed faster. The module produces what’s called a JAR, for Java ARchive, and Buck creates what Facebook calls a stub JAR that strips out anything in the code that doesn’t depend on the module so the entire code doesn’t need to be compiled and thus can be compiled faster.
One new change, called dependency class usage tracking, reduces the work needed to compile a new edit of the code. For example, a code module may be tasked with communicating with a server, and other modules may involve user interface elements that need to talk to the server. The change involves keeping track of elements such as parts of the UI in that example that don’t change, so they don’t need to be recompiled when other code is changed.
That change resulted in a 35 percent reduction in the number of rules that need to be built during compiling, translating roughly to a similar reduction in compilation time. “You don’t see that kind of win every day,” Keljo said.
Another change, called rule pipelining, is intended to make that crunched-down work go faster by reducing unnecessary bottlenecks involving the stub JAR so more compilation can be done in parallel rather than in series. That saved 10 percent more in build times.
A third change to the compilation process, called source-only stub generation, a new way of generating stub JARS essentially reduced the levels of dependencies among modules, reducing build times by 30 percent more. “This win has more staying power,” Keljo said, because as an app gets larger and larger, the benefits continue to accrue.
The bottom line is that Android developers building complex apps now can compile their code in seconds rather than minutes, Facebook said.
Facebook itself used these changes on its latest Instagram build, and it’s working on rolling them out to other Facebook apps.
Image: Facebook
A message from John Furrier, co-founder of SiliconANGLE:
Your vote of support is important to us and it helps us keep the content FREE.
One click below supports our mission to provide free, deep, and relevant content.
Join our community on YouTube
Join the community that includes more than 15,000 #CubeAlumni experts, including Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger, and many more luminaries and experts.
THANK YOU