This is an example of how to measure the time of a sum of numbers
let numbersArray = [1,2,3,4,5,6,7,8,9,1,2,3,4,5,6]
func showBenchmarkTime(title:String, operation:()->()) {
    let startTime = CFAbsoluteTimeGetCurrent()
    operation()
    let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
    print("Time elapsed for \(title): \(timeElapsed) s.")
}
showBenchmarkTime(title: "sum an array of numbers") {
    print(numbersArray.reduce(0, +))
}
solved is there a way to measure Swift’s performance without building UI on iPhone with Xcode 11? [closed]