下面是图像请求的 Volley 日志的快照。几乎一半的渲染时间是由于网络队列占用。另一个甚至更高,大部分时间都在网络队列中。如何对此进行优化以使网络队列获取更快?什么决定了网络队列的速度(除了线程优先级,图像请求默认为低优先级请求)?
注意:我是在三星 Galaxy S4 上运行的。
08-07 11:01:09.560: D/Volley(938): [1] MarkerLog.finish: (3662 ms) [ ] http://farm6.static.flickr.com/5487/9452149004_c4ba6d2d97_t.jpg 0x8da7e4ac LOW 84
08-07 11:01:09.560: D/Volley(938): [1] MarkerLog.finish: (+0 ) [ 1] add-to-queue
08-07 11:01:09.565: D/Volley(938): [1] MarkerLog.finish: (+0 ) [12239] cache-queue-take
08-07 11:01:09.565: D/Volley(938): [1] MarkerLog.finish: (+0 ) [12239] cache-miss
08-07 11:01:09.570: D/Volley(938): [1] MarkerLog.finish: (+1694) [12243] network-queue-take
08-07 11:01:09.570: D/Volley(938): [1] MarkerLog.finish: (+1852) [12243] network-http-complete
08-07 11:01:09.570: D/Volley(938): [1] MarkerLog.finish: (+50 ) [12243] network-parse-complete
08-07 11:01:09.575: D/Volley(938): [1] MarkerLog.finish: (+21 ) [12243] network-cache-written
08-07 11:01:09.575: D/Volley(938): [1] MarkerLog.finish: (+0 ) [12243] post-response
08-07 11:01:09.580: D/Volley(938): [1] MarkerLog.finish: (+45 ) [ 1] done
这是另一个需要更长的时间:
08-07 11:01:09.845: D/Volley(938): [1] MarkerLog.finish: (3871 ms) [ ] http://farm3.static.flickr.com/2827/9451437485_921584cdea_t.jpg 0x24a8bf69 LOW 85
08-07 11:01:09.860: D/Volley(938): [1] MarkerLog.finish: (+0 ) [ 1] add-to-queue
08-07 11:01:09.865: D/Volley(938): [1] MarkerLog.finish: (+1 ) [12239] cache-queue-take
08-07 11:01:09.870: D/Volley(938): [1] MarkerLog.finish: (+0 ) [12239] cache-miss
08-07 11:01:09.870: D/Volley(938): [1] MarkerLog.finish: (+2543) [12242] network-queue-take
08-07 11:01:09.875: D/Volley(938): [1] MarkerLog.finish: (+1280) [12242] network-http-complete
08-07 11:01:09.880: D/Volley(938): [1] MarkerLog.finish: (+26 ) [12242] network-parse-complete
08-07 11:01:09.885: D/Volley(938): [1] MarkerLog.finish: (+14 ) [12242] network-cache-written
08-07 11:01:09.885: D/Volley(938): [1] MarkerLog.finish: (+0 ) [12242] post-response
08-07 11:01:09.890: D/Volley(938): [1] MarkerLog.finish: (+7 ) [ 1] done
08-07 11:01:09.905: D/dalvikvm(938): GC_CONCURRENT freed 973K, 11% free 14796K/16583K, paused 12ms+6ms, total 56ms