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

换肤性能测试 #1

Open
fengshenzhu opened this issue Feb 2, 2016 · 3 comments
Open

换肤性能测试 #1

fengshenzhu opened this issue Feb 2, 2016 · 3 comments

Comments

@fengshenzhu
Copy link
Owner

No description provided.

@fengshenzhu
Copy link
Owner Author

指标:时间、内存
时机:换肤当前界面、打开新界面、返回的界面、app启动

@fengshenzhu
Copy link
Owner Author

大量布局View
大量手动add View
大量自定义View
大量Fragment
大量Activity

@fengshenzhu
Copy link
Owner Author

前提

  • 设备:Nexus 6, Android 6.0.1
  • 指标:耗时(ms)/内存增长(M)
  • db:default->black
  • bd:black->default
  • 原生启动:不添加换肤库时的启动时间。由于无换肤,当前/返回不考虑。

结果

测试项 条件 db当前 db启动 db返回 bd当前 bd启动 bd返回 原生启动
TextView textColor@color 2000 249/3 1080/8 230/2 66/3 820/6 60/400k 920/6
TextView background@drawable 2000,10k png 330/6 1260/12 340/4 89/4 920/8 96/2.5
CustomView @color @drawable @string 2000,10k png 800/13 380/11 780/7 190/2 350/5 220/2 560/5
Fragment ViewPager100,每个Fragment100个TextView textColor@color,缓存5 374/2.5 94/0.5 231/1.5 40/0 292/1.5
Fragment ViewPager100,每个Fragment100个TextView textColor@color,缓存10 700/4 160/1 500/3 56/0 580/2.5

说明

  • TextView background @drawable图片资源缓存100k的png,耗时增长不多,内存增长明显,后面不研究图片大小对库性能的测试影响。
  • ViewPager缓存Fragment为50时,无论是否添加换肤库,启动时间都超过2s,此情况下就未深测。开发者需注意控制Activity启动时被启动Fragment的数量。
  • 其它支持的系统View换肤属性如ImageView@src、ListView divider情况类似TextView的textColor和View的background,只是设置系统属性耗时本身有区别。
  • 可以发现默认主题下添加换肤的启动比原生启动还略块。换肤库中手动设置了LayoutInfater的Factory,省去了Android系统的一些操作。

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

1 participant