The goal is to test the performance of the ViewHolder pattern in the following scenarios:
- Worst possible implementation; Always inflate the layout
- Good implementation; Reuse the
convertViewwhen not null - Best implementation; Use the ViewHolder pattern
Three build flavors are used which contain the different Adapter implementations:
Baddoge- Always inflates the row layoutGooddoge- Recycles the view ifconvertViewis not nullBestdoge- Uses the ViewHolder pattern.
The two default built types are used:
Debug- ContainsDebug.start/endTracecall ingetView()to generate the Trace fileRelease- No Tracing, what should be used if you want to run themonkeyscript to capture thefpsof the ListView.
The test app is a ListFragment that contains 10,000 row items. The row item view contains seven total views.
./gradlew tasks to see what assemble and install tasks are available
All tests were performed on the a Galaxy S4 API Level 17 emulator using Genymotion.
Each adapter implementation was profiled with Traceview. The Traceview files
can be found in the traces folder. In addition to profiling with Traceview, a
monkey script was used to calculate the frames per second of the ListView. The
monkey script was ran 25 times for each adapter implementation which in turn was
used to calculate an average fps.
Results of running the test on a Galaxy S4 API Level 17 Genymotion emulator.
| Bad | Good | Best | |
|---|---|---|---|
| Average FPS | 46.455 | 47.145 | 49.501 |
| Real Time/Call | 8.328 | 0.832 | 0.715 |
| *Real Time/Call in milliseconds |

