 
 @inline(never)
 public func run_ReplaceLargeBuffer(_ N: Int) {
-    let data = medium
+    let data = sampleData(.medium)
     let replacement = sampleData(.large)
     let sz = replacement.count
     replacement.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) in


@inline(__always)
func getRandomBuf(_ arg: UnsafeMutableBufferPointer<UInt8>) {
#if os(Linux)
    let fd = open("/dev/urandom", O_RDONLY)
    defer { if (fd >= 0) { close(fd) } }
    if fd >= 0 {
         read(fd, arg.baseAddress, arg.count)
    }
#else
    arc4random_buf(arg.baseAddress, arg.count)
#endif
}

@inline(__always)
func getRandomBuf(baseAddress: UnsafeMutablePointer<UInt8>, count: Int) {
#if os(Linux)
    let fd = open("/dev/urandom", O_RDONLY)
    defer { if (fd >= 0) { close(fd) } }
    if fd >= 0 {
         read(fd, baseAddress, count)
    }
#else
    arc4random_buf(baseAddress, count)
#endif
}

func sampleBridgedNSData() -> Data {

    let other = sampleData(.large)
    benchmark_AppendData(N, data, other)
}

@inline(never)
public func run_createEmpty(_ N: Int) {
    for _ in 0..<100000 * N {
        blackHole(Data())
    }
}

@inline(never)
public func run_createSmall(_ N: Int) {
    for _ in 0..<100000 * N {
        blackHole(sampleData(.small))
    }
}

@inline(never)
public func run_createMedium(_ N: Int) {
    for _ in 0..<10000 * N {
        blackHole(sampleData(.medium))
    }
}

@inline(never)
public func run_createLarge(_ N: Int) {
    blackHole(sampleData(.veryLarge))
}

@inline(never)
public func run_createEmptyArray(_ N: Int) {
    for _ in 0..<100000 * N {
        blackHole(Data([]))
    }
}

@inline(never)
public func run_createSmallArray(_ N: Int) {
    for _ in 0..<100000 * N {
        blackHole(Data([0, 1, 2, 3, 4, 5, 6]))
    }
}

@inline(never)
public func run_createMediumArray(_ N: Int) {
    for _ in 0..<10000 * N {
        blackHole(Data([0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6]))
    }
}

@inline(never)
public func run_DataToStringEmpty(_ N: Int) {
    let d = Data()
    for _ in 0..<10000 * N {
        let s = String(decoding: d, as: UTF8.self)
        blackHole(s)
    }
}

@inline(never)
public func run_DataToStringSmall(_ N: Int) {
    let d = Data([0x0D, 0x0A])
    for _ in 0..<10000 * N {
        let s = String(decoding: d, as: UTF8.self)
        blackHole(s)
    }
}

@inline(never)
public func run_DataToStringMedium(_ N: Int) {
    let d = Data([0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A, 0x0D, 0x0A])
    for _ in 0..<10000 * N {
        let s = String(decoding: d, as: UTF8.self)
        blackHole(s)
    }
}

@inline(never)
public func run_StringToDataEmpty(_ N: Int) {
    let s = ""
    for _ in 0..<10000 * N {
        let d = Data(s.utf8)
        blackHole(d)
    }
}

@inline(never)
public func run_StringToDataSmall(_ N: Int) {
    let s = "\r\n"
    for _ in 0..<10000 * N {
        let d = Data(s.utf8)
        blackHole(d)
    }
}

@inline(never)
public func run_StringToDataMedium(_ N: Int) {
    let s = "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
    for _ in 0..<10000 * N {
        let d = Data(s.utf8)
        blackHole(d)
    }
}
