Skip to content

Latest commit

 

History

History
 
 

ConstraintLayoutPerformance

ConstraintLayout performance comparison

This app is an example test set that compares how the different ViewGroups (ConstraintLayout vs traditional layouts) affects the UI performance.

Introduction

This app runs the measure/layout passes with the layout using ConstraintLayout and using traditional layouts (RelativeLayout and LinearLayout), both of them result in the same appearance but how the UI components are built is different.

LayoutCodelab-UI

While running the measure/layout passes, the performance of UI is measured by using Systrace and OnFrameMetricsAvailableListener

Pre-requisites

You need to know:

How to run the tests

  1. Download the code.
  2. Open the terminal at the downloaded directory.
  3. Run the following shell script ./run.sh <device_id>
  • The script is going to generate two html files as a result of running Systrace. Each represents the performance result for the layout with ConstraintLayout and with traditional.

(Optional)

  • The app also logs the measurement result using OnFrameMetricsAvailableListener, but it isn't exported to any external files. You can check those stats as well.

Measurement result example

Here is the example measurement result.

Comparison example unit: ms, Time taken in measure and layout phases average of 100 frames

Measurement environment

Device Nexus 5X
Android Version 8.0
ConstraintLayout version 1.0.2