Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement detected by BlockCanary #13

Open
markzhai opened this issue Apr 14, 2016 · 12 comments
Open

Performance improvement detected by BlockCanary #13

markzhai opened this issue Apr 14, 2016 · 12 comments

Comments

@markzhai
Copy link

TagView

private void drawTags() {
...
View tagLayout = (View) mInflater.inflate(R.layout.tagview_item, null);
...
}

drawTags is called in addTag, which makes it inflate multiple times if we iterator server result to addTag.

Suggestion:
maybe expose a method to call drawTags, instead of call it everytime when add a tag.

@markzhai markzhai changed the title Performance improvement Performance improvement detected by BlockCanary Apr 14, 2016
@CaMnter
Copy link

CaMnter commented Apr 14, 2016

mInflater.inflate的View缓存下来List。下次再从服务端拿数据,比如下拉刷新的时候,判断缓存是否存在,存在拿出View加载数据+渲染样式,缓存不够,则mInflater.inflate。

@CaMnter
Copy link

CaMnter commented Apr 14, 2016

@markzhai 为什么两个中国人,用英文交流?

@markzhai
Copy link
Author

@CaMnter 啊擦 外面的README是英文啊。。。
耗时的是inflate,但其实这里的addTag没必要每次都去调用drawTags,其实我只需要最后全部都add完了再drawTags一下。现在的drawTags会遍历所有tag,这样等于做了很多没用的活儿。

@CaMnter
Copy link

CaMnter commented Apr 14, 2016

soga! @markzhai
@kaedea 出来背锅吧。

@markzhai
Copy link
Author

@kaedea
另一个问题:要动态修改tag为Deletable的话,也没有接口去触发重绘。。。

@CaMnter
Copy link

CaMnter commented Apr 14, 2016

@markzhai 目前,他已经在开发加载插件化架构开发中炸裂了,这个库子一时半会没时间修 2333 ,实在不行你来个PR吧 2333。

@markzhai
Copy link
Author

@CaMnter 卧槽,不好好工作,去搞插件开发,竟然不炒鱿鱼

@CaMnter
Copy link

CaMnter commented Apr 14, 2016

@markzhai 开发那个就是他的工作,此库子被你发掘出来,已经成为了他的黑历史,2333 。

干的漂亮!

@markzhai
Copy link
Author

@CaMnter 另外几个功能类似的,都没他这个好用,虽然这个也有坑。。。

@kaedea
Copy link
Owner

kaedea commented Apr 14, 2016

这个裤子从2015.05开始就有重构的计划:
1.改用SpannerString;
2.增加动画;
3.增加TAG排序和组合的策略;
(-ω-`)⌒)_ 工作累成狗

@CaMnter
Copy link

CaMnter commented Apr 14, 2016

@markzhai 做过类似的需求,用的是FlowLayout ,动态addView进去。

@kaedea
Copy link
Owner

kaedea commented Apr 15, 2016

等新桌子到后,来一波重构吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants