Skip to content

Instantly share code, notes, and snippets.

@torpedo87
Created August 24, 2018 11:34
xcode instruments

Instrument (command + i)

  • time profiler : 데이터 수집
  • 문제 확인 -> 데이터 수집 -> 문제 원인 가설 설정 -> 코드 수정 -> 데이터 수집 -> 가설이 맞는지 확인
  • call tree 에서 비중이 큰 작업이 무엇인지 확인해본다

performance

  • main thread 에서 하지 말아야 할 작업을 찾아서 백그라운드에서 실행되도록 디스패치시킨다
  • cold launch : 처음 앱 설치해서 실행
  • warm launch : 이미 설치된 앱이라서 캐시에 저장되어 빨리 실행됨
  • pre-main time : 앱 실행 시 main() 함수가 호출되기 전 걸리는 시간. 다이나믹 라이브러리를 static 라이브러리로 재설치하면 pre-main time을 줄일 수 있다 podfile에서 use framework 를 주석처리하면 static 라이브러리로 설치된다
  • before main() : dynamic library loading
  • after main() : application will finish launching , application did finish launching

memory

  • 순환 참조 발생하지 않도록 주의
  • memory graph debug tool : ! 표시된 객체를 찾아서 순환참조를 확인하기
  • leaks instrument : time profiler 와 같이 콜스택을 확인 할 수 있는데 특히 누수된 부분의 스택을 확인 가능. 그리고 memory graph debug tool 와 같이 객체간 참조관계 그래프도 확인 가능

Core animation instrument

  • alpha blending : 뷰가 겹치는 부분에 두 뷰의 색이 섞여서 원치 않는 색으로 나오는 부분 확인
  • offscreen rendering : 뷰의 layer property를 변경하려고 할 때 CPU와 GPU는 offscreen context를 준비해야 하는데 이를 준비하는 데 충분치 않으면 뷰에 반영이 되지 않는다. 따라서 다른 방법을 사용해서 visual effect를 적용할 방법을 강구해야 한다.

battery

  • energy log instrument : time profiler를 추가해서 정보를 수집하면 배터리를 많이 소비하는 부분의 원인이 무엇인지 알기 쉽다
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment