Created
January 19, 2017 10:49
-
-
Save artem-sherbachuk/5a4e27148715b61cfcc4fcf845b77001 to your computer and use it in GitHub Desktop.
measure code execution time with block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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