Skip to content

Instantly share code, notes, and snippets.

@artem-sherbachuk
Created January 19, 2017 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artem-sherbachuk/5a4e27148715b61cfcc4fcf845b77001 to your computer and use it in GitHub Desktop.
Save artem-sherbachuk/5a4e27148715b61cfcc4fcf845b77001 to your computer and use it in GitHub Desktop.
measure code execution time with block.
func measure(title: String, block: (() -> ()) -> ()) {
let startTime = CFAbsoluteTimeGetCurrent()
block {
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime
println("\(title):: Time: \(timeElapsed)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment