This app is an example test set that compares how the different ViewGroups (ConstraintLayout vs traditional layouts) affects the UI performance.
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.
While running the measure/layout passes, the performance of UI is measured by using Systrace and OnFrameMetricsAvailableListener
You need to know:
- Review the XML file to know how each layout is built
- Download the code.
- Open the terminal at the downloaded directory.
- 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.
Here is the example measurement result.
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 |