1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

benchmark rethrows.

This commit is contained in:
Rob Rix 2015-11-03 10:19:51 -05:00
parent a646f03748
commit 2651c5ac51

View File

@ -3,9 +3,9 @@ import Doubt
import Prelude
import Madness
func benchmark<T>(label: String? = nil, _ f: () -> T) -> T {
func benchmark<T>(label: String? = nil, _ f: () throws -> T) rethrows -> T {
let start = NSDate.timeIntervalSinceReferenceDate()
let result = f()
let result = try f()
let end = NSDate.timeIntervalSinceReferenceDate()
print((label.map { "\($0): " } ?? "") + "\(end - start)s")
return result