Skip to content

Instantly share code, notes, and snippets.

View sergigracia's full-sized avatar
🏖️
Working Remotely

Sergi Gracia sergigracia

🏖️
Working Remotely
View GitHub Profile
@MugunthKumar
MugunthKumar / measure.swift
Last active February 22, 2016 23:34
Measures Time Taken for a closure to run
func measure(prefix: String = "Time Taken", closure:()->()) {
let a = CFAbsoluteTimeGetCurrent()
closure()
let b = CFAbsoluteTimeGetCurrent()
let m = ((b-a) * 1000.0)
print("\(prefix): \(m) ms")
}