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.
Since you’re here …
Show your support for our mission with our one-click subscription to our YouTube channel (below). The more subscribers we have, the more YouTube will suggest relevant enterprise and emerging technology content to you. Thanks!
Support our mission: >>>>>> SUBSCRIBE NOW >>>>>> to our YouTube channel.
… We’d also like to tell you about our mission and how you can help us fulfill it. SiliconANGLE Media Inc.’s business model is based on the intrinsic value of the content, not advertising. Unlike many online publications, we don’t have a paywall or run banner advertising, because we want to keep our journalism open, without influence or the need to chase traffic.The journalism, reporting and commentary on SiliconANGLE — along with live, unscripted video from our Silicon Valley studio and globe-trotting video teams at theCUBE — take a lot of hard work, time and money. Keeping the quality high requires the support of sponsors who are aligned with our vision of ad-free journalism content.