Android – what makes retrofitting faster than asynctask of httpurlconnection class?

The following blog gives a comparison between the speeds of various Android async HTTP clients. Can anyone explain what makes the transformation so fast?

resolvent:

Editor: after browsing the blog post again, the one-to-many threading problem may be incorrect. The problem is that they do not share the details of their performance analysis / benchmark. That set of numbers does not provide much insight. They say, "we determine that retrieving data from API (Network) is the bottleneck", But they don't decompose so much. Do they set all volley and retrofit requests to single thread? Do they try to multithread asynctasks so that they can compare apple with apple? They didn't specify

If parsing the response into jsonobject will slow down your application, one of my methods is to use jsonreader to parse the response in an event driven manner. This may involve more code, but the advantage is that you can get fine-grained control, so you can skip everything without wasting time to parse unnecessary values. According to your application, This alone can greatly increase the speed

Personally, I think they think retrofit is easier to use, which is a more attractive reason to choose it to handle server access in my application

In the asynctask document under execution order:

This means that each request is not only waiting for the last request to complete, but also waiting for all its JSON to be read / parsed

By default, asynctask is single threaded, but retrofit is not. In order to make the test fair, they should use ThreadPoolExecutor for asynctasks. If they don't point out this difference, dishonesty will prevail. I'm surprised that they don't know the single threaded nature of asynctask

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>