androidandroid-layoutandroid-recyclerviewlayout-inflatersystrace

What does VerifyClass inside Systrace mean?


I´m looking at the systrace generated by my app and I have identified a frame that is taking too long. This is caused by a RecyclerView's onCreateViewHolder when inflating my item view. The item view is as flat as posible with ConstraintLayout. But the below systrace report has a lot of VerifyClass blocks that take 17 ms each.

What does that VerifyClass blocks mean?

enter image description here


Solution

  • It's hard to say what VerifyClass is exactly doing, because it's not a part of Android Java SDK or ConstraintLayout. The only mention I found is in C part of SDK:

    http://www.androidpolice.com/android_aosp_changelogs/android-m-preview-2-to-android-7.0.0_r1-AOSP-changelog.html

    But I have couple of suggestions:

    1) Try to build your app in release mode and see if you still have issues with FPS drop. My assumption is that this VerifyClass is executed for debug builds to benchmark certain things, but that's only a guess.

    2) While ConstraintLayout has convenient API, and flat hierarchy (which positively affects drawing traversals) it still has much slower measuring and layout process than other Android Layouts. The reason for this is the complexity of constraints calculation. So using it in a RecyclerView might result a significant performance hit during ViewHolder creation. If the hierarchy of list cell is simple enough, I'd suggest switching to some vanilla layouts and check the behavior.