Performance degradation of camera image acquisition with ARKit on iPhone 12 Pro with iOS 14.5.1.

After updating to iOS 14.5.1 on the iPhone 12 Pro and iPhone 12 Pro Max at hand, I have observed a performance degradation in the process of acquiring camera images in ARKit.

The simplest code to reproduce this looks like this

Code Block
class ViewController: UIViewController, ARSCNViewDelegate {
@IBOutlet var sceneView: ARSCNView!
// ...
func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
guard let frame = sceneView.session.currentFrame else {return}
let pixelBuffer = frame.capturedImage
DispatchQueue.main.async(execute: {
let startTime = NSDate.timeIntervalSinceReferenceDate
let context = CIContext(options:nil)
let orientation = UIApplication.shared.statusBarOrientation
let viewportSize = self.sceneView.bounds.size
var image = CIImage(cvPixelBuffer: pixelBuffer)
let transform = frame.displayTransform(for: orientation, viewportSize: viewportSize).inverted()
image = image.transformed(by: transform)
guard let cameraImage = context.createCGImage(image, from: image.extent) else {return}
let endTime = NSDate.timeIntervalSinceReferenceDate
print(endTime - startTime)
})
}
// ...
}

The code for the entire project, which you can build and try out, is uploaded below.
https://github.com/thorikawa/arkit-snapshot-performance/archive/refs/heads/main.zip

This acquires the image from the current ARFrame as a CGImage and displays the elapsed time in the console. On an iPhone 12 Pro with iOS 14.4.2, it takes about 8-10 milliseconds, while on an iPhone 12 Pro with iOS 14.5.1, it takes about 18-20 milliseconds, sometimes over 30 milliseconds.

Is this a problem with the iOS and will performance return to normal in the future? Also, is there any way to avoid the performance degradation in the 14.5.1 version?
As a side note, I also checked with iPad Pro 4th generation and did not experience this performance degradation issue. So far, I've only seen it on the iPhone 12 Pro and iPhone 12 Pro Max.
I have encountered similar symptoms.
Calling not only CIImage but also MTLTexture and other classes that allocate memory on the GPU takes a very long time.
I guess it is taking time to copy memory from CPU to GPU.
Note that I encountered this phenomenon with iPhone 12 Pro Max (iOS 14.5.1) and confirmed that there is no problem with iPad Pro 4th (PadOS 14.5).
After the last update (iOS 14.5.1), my camera stopped working properly. A lot of times when I click to take a photo, the camera doesn’t go through and no picture is taken….very frustrating since is a new phone and I never had a problem w/the camera prior to this last update. I hope they’re going to fix this. I am getting very frustrated and annoyed with Apple. Seriously considering switching to android
<deleted>
Confirmed it has been fixed on iOS 14.6 iPhone 12 Pro.
Performance degradation of camera image acquisition with ARKit on iPhone 12 Pro with iOS 14.5.1.
 
 
Q