Skip to content

Instantly share code, notes, and snippets.

@kostiakoval
Last active December 12, 2015 11:11
Show Gist options
  • Save kostiakoval/4058302cb4af22df0986 to your computer and use it in GitHub Desktop.
Save kostiakoval/4058302cb4af22df0986 to your computer and use it in GitHub Desktop.
loop-speed
let startTime = CACurrentMediaTime()
var sum = 0
for var i = 0; i < 100_000_000; i++ {
//sum += Int(arc4random_uniform(UINT32_MAX))
sum += i
}
let totalTime = CACurrentMediaTime() - startTime
print("time: - \(totalTime) sec")
print("total: \(sum)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment