setNeedsDisplay grows linear with drawRect:

Originator:sven.titgemeyer
Number:rdar://31113056 Date Originated:17-Mar-2017
Status:Open Resolved:
Product:iOS + SDK Product Version:
Classification:Performance Reproducible:Always
 
Area:
UIKit

Summary:
setNeedsDisplay should notify the system that the view needs to be redrawn but return immediately. In the attached Playground and Screenshot you can see that the time in setNeedsDisplay grows linear with the time spent in drawRect:.

Steps to Reproduce:
1. Open attached playground
2. add graphs for the variables `timeInSetNeedsDisplay` and `timeInDrawRect`
3. draw by panning in the live view

Expected Results:
setNeedsDisplay should return in constant time

Actual Results:
setNeedsDisplay grows linear with drawRect:

Version:
Swift Playground, Macbook Pro, macOS 10.12.3, Xcode 8.2.1

Notes:


Configuration:
Swift Playground, Macbook Pro 10.12.3, Xcode 8.2.1

Playground can be found here: https://gist.github.com/iCarambaa/204fe7599dd59e3b378eb91f65fba4d6
Screenshot with results on Twitter: https://twitter.com/s_titgemeyer/status/842725720958930944

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!