mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
benchmark
rethrows.
This commit is contained in:
parent
a646f03748
commit
2651c5ac51
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user