Facebook Tackles Android UIs with New Open Source Tool
That homegrown framework, originally called Components for Android (C4A), has been open sourced under a new name, Litho.
As with most things produced by Facebook engineering, it emphasizes painstaking performance optimization and other techniques required for immense scaling at a level that few -- if any -- other companies have to worry about, but Facebook thinks it will be useful for others as well.
"Litho lays out components ahead of time in a background thread, and renders incrementally to deliver best-in-class performance for your users," Facebook engineers said in a blog post published during the company's F8 conference this week. "We believe Litho solves challenges that are not unique to Facebook. This is why we're excited about what Litho can do for Android developers everywhere."
One thing it's designed to do for Android developers is match the 60 frames-per-second screen refresh threshold for smooth performance on mobile devices that feature a wide gamut of performance capabilities, which Facebook said requires the ability to render UI changes continuously every 16 ms.
"As UIs become increasingly sophisticated, it gets harder to complete all the rendering work that needs to get done in this time frame," Facebook said. "This proves to be especially challenging with dynamic scrolling surfaces, as new pieces of UI are constantly being introduced onscreen."
Litho, the company said, was specifically tuned to work better with scrolling surfaces, moving compute-intensive operations to a background thread and performing rendering across multiple frames.
It also borrows from React's emphasis on composing complex UIs with a chain of small components that make up simple constructs such as text, images and videos.
Facebook said, "Since being used across our apps, Litho has delivered great results, including an improvement in scroll performance of up to 35 percent, better memory behavior with complex lists, and easier-to-test UI code."
The code for Litho can be found on GitHub. More information can be found in a getting started site for setup and other initial guidance, a Hello World tutorial, a sample app and complete documentation.
David Ramel is an editor and writer for Converge360.