 import Foundation
 import Base32
 
-func measureBlock(_ block: () -> ()) -> CFTimeInterval {
+func measureBlock(_ block: () throws -> Void) rethrows -> CFTimeInterval {
     let startTime = CFAbsoluteTimeGetCurrent()
-    block()
+    try block()
     let endTime = CFAbsoluteTimeGetCurrent()
     return endTime - startTime
 }

let foxResult = secBase32Encode(data: foxData)
let n = 1000
compareEncoding(from: foxData, to: foxResult, times: n)

/*
let c = 25

    print("Base duration: \(secDuration)")
    let duration = measureEncoding(from: data, to: encodedString, using: Base32.encode, times: times)
    print("  My duration: \(duration)")
    let previousBest = 0.11406124114990235
    print("Previous best: \(previousBest)")
    let improvement = 1 - (duration / previousBest)
    print("Improvement: \(round(improvement*10000)/100)%")
