ARView lags when adding MeshResource to Anchor

Below is my function that adds text to an Anchor. In my case the Anchor is an image anchor and I am wondering how to remove the lag when the text is added.

Code Block func addTextToAnchor(anchor: AnchorEntity, text:String, fontSize: CGFloat, color:SimpleMaterial.Color, x: Float, y: Float, z: Float, scale: SIMD3<Float>) {  let mesh = MeshResource.generateText(        text,        extrusionDepth: 0.0,        font: .init(descriptor: .init(name: "Consolas", size: fontSize), size: fontSize),        containerFrame: .zero,        alignment: .center,        lineBreakMode: .byWordWrapping)  let position = SIMD3<Float>(x,y,z)  let material = UnlitMaterial(color: color)  let entity = ModelEntity(mesh: mesh, materials: [material])     entity.name = "title"  entity.setScale(scale, relativeTo: anchor)  anchor.addChild(entity)  entity.position = position  entity.transform.rotation = simd_quatf(angle: -.pi/2, axis: [1,0,0])  return}

ARView lags when adding MeshResource to Anchor
 
 
Q