-
-
Save qyzhaojinxi/19c23aa34a0e4630d528d1e323c9d7b0 to your computer and use it in GitHub Desktop.
性能优化及测试方法 #性能优化
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🌟性能优化 | |
Android产品内存和cpu测试及优化方案 | |
一、如何测试: | |
1.第三方平台测试:testin,腾讯u测 | |
使用第三方平台工具测试当前app内存和cpu占用 | |
2.使用工具人工测试: | |
分别测试各个功能模块,检测出内存和cpu的增加,以及内存泄漏情况(网易测试工具,itest,或者studio自带工具,内存泄露使用leak) | |
两个方面:1)测试内存和cpu变化 | |
2)使用leak工具测试内存泄露 | |
3.根据结果优化代码逻辑,优化资源占用 | |
二、如何优化: | |
1.定位问题点:内存优化可以从多角度来找入手点,一个是下边那篇文章里关于内存需要注意的点,同时使用itest监控找出内存增长点,另一个是使用leak插件,可以定位明显内存泄漏代码位置,第三个从代码里边具体算法上优化,例如重复创建对象,for循环的size是否写在size外边等 | |
2.多个角度优化 | |
针对布局,静态变量使用,上下文,数据库,listview,图片,网络等: | |
http://mobile.51cto.com/android-410883.htm | |
http://www.cnblogs.com/zyw-205520/archive/2013/02/17/2914190.html | |
三、如何衡量优化效果: | |
使用同一个设备,按照之前流程分别测试,对比内存占用数据。同时也可以对比第三方平台如testin的前后数据变化 | |
补充:Java编程规范 | |
http://techforum-img.cn-hangzhou.oss-pub.aliyun-inc.com/阿里巴巴Java开发手册.pdf | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
具体优化方法看内容网址