Appending UIBezierPaths and adding CGPaths unusably slow on iOS 13?

I ran into an issue on iOS 13(Simulator and Device) where if I try appending UIBezierPaths, or try adding CGPaths instead, that it takes infinitely long(like 1000x slower) to complete whereas running the same exact code on 12.4(Simulator I have no <13 devices) finishes within a couple seconds. Did something change in regards to UIBezierPaths/CGPaths in 13 that would impact the performance so much?


Here’s an example:

let path = CGMutablePath() 
for i in 0...1000 { 
   print(i) 
   for k in 0...1000 { 
     let rect = CGRect(x: i, y: k, width: 10, height: 10) 
     let rectPath = CGPath(rect: rect, transform: nil) 
     path.addPath(rectPath) 
   }
} 

let bezier = UIBezierPath(rect: CGRect.zero) 
for i in 0...1000 { 
  print(i) 
  for k in 0...1000 { 
    let rect = CGRect(x: i, y: k, width: 10, height: 10) 
    let bezierRect = UIBezierPath(rect: rect) 
    bezier.append(bezierRect) 
  } 
}


Running this with iOS 13 as the target is unusable whereas on iOS 12 it will finish in a couple seconds.

Hey Clawsome,

Any resolution to your problem. I am facing same problem. CGPathAddPath in a loop is excruciatingly slow in ios 13.

Here is my link. https://forums.developer.apple.com/thread/128784

Appending UIBezierPaths and adding CGPaths unusably slow on iOS 13?
 
 
Q