picasso vs UIL
2015-11-22 10:11
513 查看
图片加载开源库学习笔记(好记性不如烂笔头)
picasso:
1.picasso.load -> RequestCreator -> Dispatcher ->BitmapHunter(Runnable)
2.Dispatcher:HandlerThread进行消息管理 PicassoExecutorService(DEFAULT_THREAD_COUNT 3)
3.Cache key: Utils.createKey -> uri、size
4.okhttp: NetworkRequestHandler.load -> OkhttpDownloader.load(本地 FileRequestHandler)
5.避免重复加载:Dispatcher -> performSubmit -> hunterMap(key)
UIL:
1.ImageLoader.getInstance.displayImage -> ImageLoaderEngine -> LoadAndDisplayImageTask(Runnable)
2.ImageLoaderConfiguration: memoryCache、diskCache、 DEFAULT_THREAD_POOL_SIZE 3
3.DisplayImageOptions: cacheInMemory、cacheOnDisk、showStubImage、showImageOnLoading、showImageForEmptyUri、showImageOnFail、imageScaleType、displayer、RoundedBitmapDisplayer
4.Cache key: MemoryCacheUtils.generateKey -> uri、size
5.HttpURLConnection: BaseImageDownloader.getStream -> getStreamFromNetwork(本地 getStreamFromFile)
6.避免重复加载: LoadAndDisplayImageTask -> run -> checkTaskNotActual -> isViewReused -> memoryCacheKey比较(ImageLoaderEngine.cacheKeysForImageAwares)
初步小结:
1.设计方面UIL只支持单例模式,相对于非单例模式来说,优点是共用节约内存,而缺点是不便销毁;Picasso两种模式均支持
2.在避免重复加载方面,picasso在task加入线程池前进行判重(同uri时任务合并,view复用时取消旧任务),而UIL在task开始执行的时候进行判重(view复用时当前旧任务提前结束),这块picasso稍优于UIL
3.UIL支持disk cache
4.网络方面picasso使用了okhttp
5.二者对使用列表的桌面插件支持都不完善
相关文章推荐
- Parcel: unable to marshal value {CLASSNAME}
- Arduino与PC串口通信程序中出现的问题
- 编译使用Android源码中的GIF图片工具包--framesequence
- 黑马程序员-GUI图形用户界面
- java webservice服务器端获取request对象的三种方式
- org.hibernate.QueryException: Space is not allowed after parameter prefix ':'
- Ext.QuickTips.init();
- HDU 2767 Proving Equivalences (tarjan scc)
- iOS - UIButton 开发总结
- UiDevice新增API
- HDU 2767 Proving Equivalences(强连通缩点)
- EasyUI常用控件的禁用方法
- request biji
- leetcode笔记:N-Queens II
- Druid监控数据库
- duilib 入门一之界面库基本原理
- 如何解决virtualbox中不能打开一个虚拟任务之uuid不匹配的问题
- 移植opencv到pcDuino
- arduino ide找不到目标文件
- HDU-5568 sequence2(DP+高精度)