
Posted by
Today, as part of the , Android's modern, native UI toolkit that is , . This release largely focuses on performance improvements, as major parts of our , we were focused on getting the API surface right to provide a solid foundation to build on. We wanted a powerful and expressive API that was easy to use and stable so that developers could confidently use it in production. As we continue to improve the API, performance is our top priority, and in the August ‘23 release, we have landed many performance improvements.
Modifier performance
Modifiers see large performance improvements, up to 80% improvement to composition time, in this release. The best part is that, thanks to our work getting the API surface right in the first release, most apps will see these benefits just by upgrading to the August ‘23 release.
We have a suite of benchmarks that are used to monitor for regressions and to inform our investments in improving performance. After the initial 1.0 release of Compose, we began focusing on where we could make improvements. The benchmarks showed that we were spending more time than anticipated materializing modifiers. Modifiers make up the vast majority of a composition tree and, as such, were the largest contributor to initial composition time in Compose. Refactoring modifiers to a more efficient design began under the hood in the . Modifiers build on top of each other so we started migrating our low level modifiers in . This included graphicsLayer, low level focus modifiers, padding, and offset. These low level modifiers are used by other highly utilized modifiers such as Clickable, and are also utilized by many framework Composables such as Text. Migrating modifiers in the March ‘23 release brought performance improvements to those components, but the real gains would come when we could migrate the higher level modifiers and composables themselves to the new modifier system.
In the August ‘23 release, we have begun , used by Clickable, is still in the process of being migrated, so we anticipate further gains to come in future releases.
As part of this work, we identified a use case for composed modifiers that wasn’t covered in the original refactor and added a .
Learn more about the rationale behind the changes in the when using ComposeView, which will benefit all apps but especially those that use multi-activity architecture or large amounts of View/Compose interop.
Text
BasicText has moved to a new rendering system backed by the modifier work, which has brought an average of gain of 22% to initial composition time and up to a 70% gain in one benchmark of complex layouts involving text.
A number of Text APIs have also been stabilized, including:
- TextMeasurer and
- to support lookahead in SubcomposeLayout.
- Added — they help us to improve Compose and build the APIs you need. Continue providing your feedback, and help us make Compose better!
Wondering what’s next? Check out our roadmap to see the features we’re currently thinking about and working on. We can’t wait to see what you build next!
Happy composing!
↗ Original-Artikel auf android-developers.googleblog.com lesenVollständiger Original-ArtikelDen kompletten Beitrag mit allen Details direkt auf android-developers.googleblog.com lesen.
SOCIAL SHARE CARD GENERATOR