I want to compare to different implementation of a function:
let start1 = Date()
_ = funcImplA()
let end1 = Date()
let start2 = Date()
_ = funcImplB()
let end2 = Date()
let time1 = end1.timeIntervalSince(start1)
let time2 = end2.timeIntervalSince(start2)
print("ImplA = \(time1 ), ImplB = \(time2)")
The results I'm getting is that the first measure is always slower than the second one (time1 > time2
). Meaning that if I'm switching between the calls, fist measure funcImplB()
and then funcImplA
, I'm still get that time1 > time2
.
What might be the reason?