Skip to content

Instantly share code, notes, and snippets.

@kostiakoval
Last active June 22, 2016 08:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save kostiakoval/77bccd0bfc5b01b82a9b to your computer and use it in GitHub Desktop.
Save kostiakoval/77bccd0bfc5b01b82a9b to your computer and use it in GitHub Desktop.
Measure Speed in Swift
func measure(title: String!, call: () -> Void) {
let startTime = CACurrentMediaTime()
call()
let endTime = CACurrentMediaTime()
if let title = title {
print("\(title): ")
}
print("Time - \(endTime - startTime)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment