UIKit, Performance and Beyond...

About...


Luiz Alberto


  • iOS dev just for 8 months.
  • Selected in Ci&T Think Transform
  • Fullstack .net dev for 13 years
  • In love with E-Music

Schedule


  • iOS Graphics Architecture
  • Graphics performance problems research
  • Great performance motivation
  • Tools
  • Solving problems techniques





iOS Graphics Architecture

iOS Graphics Architecture

Framework



iOS Graphics Architecture

Core Animation WorkFlow



iOS Graphics Architecture

Always target Graphics Display at 60 fps.






16.67 ms

iOS Graphics Architecture

Detailed Workflow







Graphics performance problems research

Graphics performance problems research

Checklist


  • What's the frame rate?
  • CPU or GPU bound?
  • Any unnecessary CPU rendering?
  • Too many offscreen passes?
  • Any Strange image format or sizes?
  • Any expensive views or effects?
  • Anything unexpected in hierarchy?

Graphics performance problems research

Checklist

What's the frame rate?




60 fps target

Graphics performance problems research

Checklist


CPU or GPU bound?




Lower is Better!

Graphics performance problems research

Checklist

Any unnecessary CPU rendering?



GPU is desirable but know when CPU makes sense

Graphics performance problems research

Checklist

Too many offscreen passes?




Fewer is better

Graphics performance problems research

Checklist

Any Strange image format or sizes?



Avoid on-the-fly conversions or resizing

Graphics performance problems research

Checklist


Any expensive views or effects?


Understand the cost of what is in use

Graphics performance problems research

Checklist


Anything unexpected in hierarchy?


Know the actual view hierarchy





Great performance motivation

Great performance motivation






  • Keep your user engaged with your app.
  • Get great reviews on App Store.
  • Save Battery = More time your user using your App.





Tools

Tools




  • Instruments
    • Core Animation instrument
    • OpenGL ES Driver instrument
  • Simulator
    • Color Debug options
  • Xcode
    • View debugging

Tools

Instruments


  • Core Animation Instrument
    • What's the frame rate?
    • Any unnecessary CPU rendering?
    • Too many offscreen passes?
    • Any Strange image format or sizes?
    • Any expensive views or effects?
  • OpenGL ES Driver instrument
    • CPU or GPU bound?

Tools

Simulator


  • Color Debug options
    • Any unnecessary CPU rendering?
    • Too many offscreen passes?
    • Any Strange image format or sizes?

Tools

Xcode


  • View debugging

Solving Problems Techniques

Alpha Channel





Pay attention to Blended Layers, and reduce the amount of red in your app.

Solving Problems Techniques

Offscreen Rendering



  • custom drawRect: (any, even if you simply fill the background with color)
  • CALayer corner radius
  • CALayer shadow
  • CALayer mask
  • any custom drawing using CGContext
  • CALayer corner radius
  • CALayer shadow
  • CALayer mask 
  • any custom drawing using CGContext



Thank You



twitter: @luigledr
medium: @luigledr
Made with Slides.com