Rail 퍼포먼스 모델
https://developers.google.com/web/fundamentals/performance/rail
(웹의 Idle 제외) 

onCreate에서 StrictMode 사용
if(DEVELOP_MODE) //개발모드에서만 동작하도록
{ StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build()); }
병목현상 StrictMode로 확인 정책위반시 penaltyLog() penaltyDeath() 

프로파일러 간이 스스로 System.nanoTime() 

Traceview 안드로이드 모니터 cpu탭 스톱워치 클릭으로 기록 

Systrace 4.3이상(4.1) 플랫폼툴즈systrace 
$cd android-sdk/platform-tools/systrace
$python systrace.py —time=10 -o /tmp/mynewtrace.html sched gfx view wm 
--app com.github.advanced_android.newgithubrepo
systrace도움말 https://developer.android.com/studio/command-line/systrace 

lint 레이아웃 최적화 lint --show 검사항목 리스트 
레이아웃 오른쪽 클릭->Inspect Code실행 

개발자 옵션 오버드로 활성화 

hierarchyviewer 에뮬레이터나 루팅단말이나 viewserver 도입 
https://github.com/romainguy/viewserver 

안드로이드 모니터 메모리 감시 

LeakCanary를 이용해 메모리 누수 방지 릴리즈와 테스트는 동작안함
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
releaseCompile '~~.leakcanary-android-no-op:1.3.1'(no op아무것도 하지않음)
application onCreate에서 LeakCanary.install(this); 
fragment는 RefWatcher 사용 refWatcher = LeakCanary.install(this);
application.refWatcher; 
 
HashMap 대신 ArrayMap SimpleArrayMap 사용해 메모리 최적화
오토박싱(int->Integer)을 피하기 위해 

HashMap 대신 SparseArrayCompat사용 LongSparseArray도 존재


블로그 이미지

dev김

안드로이드 개발자로 만 4년이 좀 안되게 근무했었고 그 이상의 공백을 가지고 있다. 다시 현업에 복귀하기 위한 노력의 흔적을 담으려고 한다.

,