# Comparing Jetpack Compose performance with XML

DevFeed: [Comparing Jetpack Compose performance with XML](<https://devfeed.tech/articles/comparing-jetpack-compose-performance-with-xml-37398.md>)

Original publisher: [Read original article](<https://medium.com/okcredit/comparing-jetpack-compose-performance-with-xml-9462a1282c6b?source=rss----40ea5327aac7---4>)

Author: Pratham Arora

Published: 2022-08-09T05:41:24Z

Content type: article

Language: en

Sources: [OkCredit - Medium](<https://devfeed.tech/sources/okcredit-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [XML](<https://devfeed.tech/topics/xml.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [compose](<https://devfeed.tech/tags/compose.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [mobile-app-development](<https://devfeed.tech/tags/mobile-app-development.md>), [performance](<https://devfeed.tech/tags/performance.md>), [r8](<https://devfeed.tech/tags/r8.md>), [xml](<https://devfeed.tech/tags/xml.md>)

## AI overview

An Android team compares Jetpack Compose and XML-based layouts in production using frozen-frame rate, slow-frame rate, and median page-load duration. The article also examines Android Runtime AOT compilation as context for the measured results.

## Source excerpt

As Jetpack compose is progressing towards stability, our team decided to measure the performance differences between Compose and XML-based layouts to build the foundation for gradually moving towards Jetpack compose. The differences were measured in terms of frozen frames, slow frames and page load duration. Additionally, we deep-dived into how Android Runtime (ART) optimises the performance by using Ahead-of-time (AOT) compilation. Both the below-mentioned experiments were performed on Production build with R8 enabled. Compose version used throughout was 1.1.0 Let's get started... Experiment -- 1 To begin with, we decided to convert one of the existing screens from XML to compose. Then, using our internal A/B experimentation platform, we made 2 equal cohorts/groups of users. The first cohort would experience the old XML-based screen whereas the other cohort would experience the newly compose built screen. Aim -- To understand the rendering performance of both the screens by comparing frozen frame rate, slow frame rate and page load duration. Screen -- This screen shows all the transactions as well as their summary in an interval. Results - Frozen frame percentage: For compose-based layout, the frozen frame rate came out to be 0.044% whereas it was 0.034% for XML-based layout. An alternate way to understand this can be, that if we open this XML-based activity, then nearly 3.4 frames out of 10,000 frames would fall under the frozen frame category. Similarly, for the compose-based activity, it would be 4.3 frames out of 10,000 frames. Slow frame percentage: For compose-based layout, the slow frame rate came out to be 8.91% whereas it was 9.93% for XML-based layout. Like frozen frames, ~10 out of 100 frames would fall under the slow frame category for XML-based layout. Whereas it was ~9 out of 100 frames for compose-based activity. Median Page Load Duration (in milliseconds): Internally, we define page load duration as the time taken from launching an activity to drawing it