mirror of
https://github.com/github/semantic.git
synced 2024-12-25 07:55:12 +03:00
benchmark
rethrows.
This commit is contained in:
parent
a646f03748
commit
2651c5ac51
@ -3,9 +3,9 @@ import Doubt
|
|||||||
import Prelude
|
import Prelude
|
||||||
import Madness
|
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 start = NSDate.timeIntervalSinceReferenceDate()
|
||||||
let result = f()
|
let result = try f()
|
||||||
let end = NSDate.timeIntervalSinceReferenceDate()
|
let end = NSDate.timeIntervalSinceReferenceDate()
|
||||||
print((label.map { "\($0): " } ?? "") + "\(end - start)s")
|
print((label.map { "\($0): " } ?? "") + "\(end - start)s")
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user