We have a certain type of app that is connected with server through Socket. Server usualy sends some orders (Adding orders, Updating them, and Deleting). Server sends more the 20 requests per second. And depending on those requests to Android client we have to change ListView Adapter. We are doing that, but nevertheless we have a huge load of CPU.
What do you think can be the root of this problem?
ListView implemented with ViewHolder. We do not know where to measure time and how we can define the bottleneck of this particular app.We were trying to measure parcing of request – it is ok. Also we measure view notification. It seems that it is also not to slow. View then trigered through View.post(). Maybe that MessageQueue to View is too long?
Edit: CPU load is huge even if we are not currently in the ListView (We are not seeing it)
you could refer to this amazing blog post made by Romain Guy (one of the main Android Framework engineers) that shows how to use several optimisation tools. Most of the tools showed are already included in the SDK and measure pretty precisely stuff with times in milliseconds, etc.
Very useful reading for any android developer
edit:
just a wild guess here, considering your description, maybe the CPU load comes from the mobile have to process all the information, even if the information is not relevant to it (you said that depending on the request, you change the adapter) why not make the server check this data and only send to the device what will actually be used?