$30 off During Our Annual Pro Sale. View Details »

Optimizing Render Performance with Jetpack Compose

Avatar for Will Will
October 26, 2021

Optimizing Render Performance with Jetpack Compose

Presented at Android Worldwide on October 26, 2021

Avatar for Will

Will

October 26, 2021
Tweet

More Decks by Will

Other Decks in Technology

Transcript

  1. 1. Pure XML 2. Pure Compose 3. Compose with debug

    flag disabled (but R8 off) 4. Compose with debug flag disabled and R8 enabled
  2. Guidelines for Faster Composable Renders 1. Make sure R8 is

    configured to minify all Composables
  3. 1. Compose with SetContent 2. A single Composable near the

    root of our XML 3. Many small Composables replacing pieces of the content What are our choices for screen format?
  4. Guidelines for Faster Composable Renders 1. Make sure R8 is

    configured to minify all Composables 2. More ComposeViews = Slower Render Time
  5. Guidelines for Faster Composable Renders 1. Make sure R8 is

    configured to minify all Composables 2. More ComposeViews = Slower Render Time 3. The first Composable you render is slower than subsequent composables.
  6. Guidelines for Faster Composable Renders 1. Make sure R8 is

    configured to minify all Composables 2. More ComposeViews = Slower Render Time 3. The first Composable you render is slower than subsequent composables. 4. Use State and Remember { } to minimize calculation within your Composables
  7. Guidelines for Faster Composable Renders 1. Make sure R8 is

    configured to minify all Composables 2. More ComposeViews = Slower Render Time 3. The first Composable you render is slower than subsequent composables. 4. Use State and Remember { } to minimize calculation within your Composables 5. Use keys to allow compositions to reorder and limit costly recomposition
  8. Android 1.5 - Dalvik Just-In-Time Compilation Android 5 - ART

    Ahead-Of-Time Compilation (tested in 4.4) Android 7 Hybrid Ahead-Of-Time and Just-In-Time Compilation
  9. ProfileInstaller • Baseline-prof.txt ◦ Same naming as Proguard file •

    Flag with H, S, and P ◦ Hot ◦ Startup ◦ Post-startup
  10. Guidelines for Faster Composable Renders 1. Make sure R8 is

    configured to minify all Composables 2. More ComposeViews = Slower Render Time 3. The first Composable you render is slower than subsequent composables. 4. Use State and Remember { } to minimize calculation within your Composables 5. Use keys to allow compositions to reorder and limit costly recomposition 6. Understand how JIT compilation will impact initial and subsequent renders