Created
October 27, 2016 09:20
-
-
Save hannesstruss/755e6525c9791b0d53b39a004d598fe5 to your computer and use it in GitHub Desktop.
Swift measure time
This file contains 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 Foundation | |
func measure(op: () -> ()) -> Double { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
op() | |
let elapsed = CFAbsoluteTimeGetCurrent() - startTime | |
return Double(elapsed) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment