Execution time
CoreGraphics
CALayer + clipsToBounds
CALayer + mask
CALayer + masksToBounds
Time in Milliseconds
0 1 2 3
1,41
1,66
1,91
2,4
Slide 23
Slide 23 text
Note: shouldRasterize
Slide 24
Slide 24 text
Execution time
CALayer + masksToBounds
+ shouldRasterize
Time in Milliseconds
0 1 2 3
2,3
1,41
Slide 25
Slide 25 text
shadows:
so are
they cool
or not?!
Slide 26
Slide 26 text
Shadows CALayer
CoreGraphics
UIImage
Slide 27
Slide 27 text
1) CALayer
Slide 28
Slide 28 text
1b) CALayer + shadowPath
Slide 29
Slide 29 text
2) CoreGraphics
Slide 30
Slide 30 text
3) UIImage
Slide 31
Slide 31 text
Execution time
UIImage
CALayer
CoreGraphics
CALayer + shadowPath
Time in Milliseconds
0 2 4 6 8 10
2,14
2,33
3,34
9,82
Slide 32
Slide 32 text
rounded
corners
+
shadows:
you think
it’d be easy
but it’s not
Slide 33
Slide 33 text
Rounded Corners
+ Shadows Shadow as UIView
CAShapeLayer
CoreGraphics
Slide 34
Slide 34 text
1) Shadow as UIView
Slide 35
Slide 35 text
2) CAShapeLayer
Slide 36
Slide 36 text
3) CoreGraphics
Slide 37
Slide 37 text
Execution time
Subview
CoreGraphics
CAShapeLayer
Time in Milliseconds
0 1 2 3
2,1
2,42
3,1
Slide 38
Slide 38 text
I’m noticing a trend…
CALayer CoreGraphics UIKit
Slide 39
Slide 39 text
CoreGraphics
Rounded Corners
Shadow
Rounded Corners + Shadow
Time in Milliseconds
0 1 2 3
2,42
2,33
2,4
Slide 40
Slide 40 text
AutoLayout?
more like
AutoDELAYout
Slide 41
Slide 41 text
Layout AutoLayout
UIStackView
Manual
Slide 42
Slide 42 text
1) AutoLayout
Slide 43
Slide 43 text
2) UIStackView
Slide 44
Slide 44 text
3) Manual Layout
Slide 45
Slide 45 text
Execution time
AutoLayout
UIStackView
Manual Layout
AutoLayout iOS 12
Time in Milliseconds
0 2,8 5,6 8,4 11,2 14
6,65
1,7
12
14
Slide 46
Slide 46 text
Final Thoughts
UIKit elements have overhead
CoreGraphics vs CoreAnimation
AutoLayout always slower than manual
Up to you to choose what meets your needs