> For the complete documentation index, see [llms.txt](https://airbnb.gitbook.io/lottie/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://airbnb.gitbook.io/lottie/android/performance.md).

# Performance

## Sizing (px -> dp)

Any pixel values in After Effects will get converted to density independent pixels (points on iOS and dp on Android). For example, if you want an animation to be 24dp x 24dp, the After Effects composition should be 24px x 24px. You can find a list of common screen sizes in dps [here](https://material.io/devices/).

## Masks and Mattes

Masks and mattes on android have the larges performance hit. Their performance hit is also proportional to the intersection bounds of the masked/matted layer and the mask/matte so the smaller the mask/matte, the less of a performance hit there will be.\
On Android, if you are using masks or mattes, there will be a several X performance improvement when using hardware acceleration.

## Hardware Acceleration

Android can render animations with hardware or software acceleration. Hardware acceleration is often much faster but has some limitations.\
The following features have limited support

* Anti aliasing (API 16+ only)
* Clip to composition bounds (API 18+ only)
* Stroke caps (API 19+ only)

For more information, read [this](https://developer.android.com/guide/topics/graphics/hardware-accel.html).

However, [it is not always faster](http://blog.danlew.net/2015/10/20/using-hardware-layers-to-improve-animation-performance/) so you should try it for your animation specifically to test.

To benchmark your animation, refer to the other sections on this page.

## Render Graph

The Lottie sample app has a real time render graph that can be enabled from the menu in the top right. It also has guidelines for 16.66 and 33.333ms per frame which represent the maximum render time to hit 60fps and 30fps respectively.<br>

![Render Graph](/files/-L7jVWWQtp8W8V3caR-N)

## Render Times Per Layer

The Lottie sample app also has a bottom sheet with the time it took each layer to render. To access it, click the render graph in the control bar and then tap "View render times per layer".

If there are any layers that are particularly slow, try optimizing their shapes, eliminated masks, mattes, and merge paths where possible.

![Render times](/files/-L7jVWWWowE60-hnpYTJ)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://airbnb.gitbook.io/lottie/android/performance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
