Last active
August 13, 2018 17:42
-
-
Save Shehryar/b1e1f4565c0eae53bdcee7ab16c6d2d9 to your computer and use it in GitHub Desktop.
Swift function execution time
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
import QuartzCore | |
func executionTimeInterval(block: () -> ()) -> CFTimeInterval { | |
let start = CACurrentMediaTime() | |
block(); | |
let end = CACurrentMediaTime() | |
return end - start | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment