zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit c050ec4e570caf53be924bcbbe4194512b6a022c (tree)
parent 81c441f8855d4c58f0b2ff86d3d007cf0bf395d3
Author: Marc Tiehuis <marc@tiehu.is>
Date:   Wed, 21 Aug 2019 20:34:12 +1200

Update hash/crypto benchmark scripts

Diffstat:
Astd/crypto/benchmark.zig | 198+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mstd/crypto/blake2.zig | 4++--
Mstd/crypto/sha2.zig | 4++--
Dstd/crypto/throughput_test.zig | 193-------------------------------------------------------------------------------
Astd/hash/benchmark.zig | 208+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dstd/hash/throughput_test.zig | 148-------------------------------------------------------------------------------
6 files changed, 410 insertions(+), 345 deletions(-)

diff --git a/std/crypto/benchmark.zig b/std/crypto/benchmark.zig @@ -0,0 +1,198 @@ +// zig run benchmark.zig --release-fast --override-std-dir .. + +const builtin = @import("builtin"); +const std = @import("../std.zig"); +const time = std.time; +const Timer = time.Timer; +const crypto = std.crypto; + +const KiB = 1024; +const MiB = 1024 * KiB; + +var prng = std.rand.DefaultPrng.init(0); + +const Crypto = struct { + ty: type, + name: []const u8, +}; + +const hashes = [_]Crypto{ + Crypto{ .ty = crypto.Md5, .name = "md5" }, + Crypto{ .ty = crypto.Sha1, .name = "sha1" }, + Crypto{ .ty = crypto.Sha256, .name = "sha256" }, + Crypto{ .ty = crypto.Sha512, .name = "sha512" }, + Crypto{ .ty = crypto.Sha3_256, .name = "sha3-256" }, + Crypto{ .ty = crypto.Sha3_512, .name = "sha3-512" }, + Crypto{ .ty = crypto.Blake2s256, .name = "blake2s" }, + Crypto{ .ty = crypto.Blake2b512, .name = "blake2b" }, +}; + +pub fn benchmarkHash(comptime Hash: var, comptime bytes: comptime_int) !u64 { + var h = Hash.init(); + + var block: [Hash.digest_length]u8 = undefined; + prng.random.bytes(block[0..]); + + var offset: usize = 0; + var timer = try Timer.start(); + const start = timer.lap(); + while (offset < bytes) : (offset += block.len) { + h.update(block[0..]); + } + const end = timer.read(); + + const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; + const throughput = @floatToInt(u64, bytes / elapsed_s); + + return throughput; +} + +const macs = [_]Crypto{ + Crypto{ .ty = crypto.Poly1305, .name = "poly1305" }, + Crypto{ .ty = crypto.HmacMd5, .name = "hmac-md5" }, + Crypto{ .ty = crypto.HmacSha1, .name = "hmac-sha1" }, + Crypto{ .ty = crypto.HmacSha256, .name = "hmac-sha256" }, +}; + +pub fn benchmarkMac(comptime Mac: var, comptime bytes: comptime_int) !u64 { + std.debug.assert(32 >= Mac.mac_length and 32 >= Mac.minimum_key_length); + + var in: [1 * MiB]u8 = undefined; + prng.random.bytes(in[0..]); + + var key: [32]u8 = undefined; + prng.random.bytes(key[0..]); + + var offset: usize = 0; + var timer = try Timer.start(); + const start = timer.lap(); + while (offset < bytes) : (offset += in.len) { + Mac.create(key[0..], in[0..], key); + } + const end = timer.read(); + + const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; + const throughput = @floatToInt(u64, bytes / elapsed_s); + + return throughput; +} + +const exchanges = [_]Crypto{Crypto{ .ty = crypto.X25519, .name = "x25519" }}; + +pub fn benchmarkKeyExchange(comptime DhKeyExchange: var, comptime exchange_count: comptime_int) !u64 { + std.debug.assert(DhKeyExchange.minimum_key_length >= DhKeyExchange.secret_length); + + var in: [DhKeyExchange.minimum_key_length]u8 = undefined; + prng.random.bytes(in[0..]); + + var out: [DhKeyExchange.minimum_key_length]u8 = undefined; + prng.random.bytes(out[0..]); + + var offset: usize = 0; + var timer = try Timer.start(); + const start = timer.lap(); + { + var i: usize = 0; + while (i < exchange_count) : (i += 1) { + _ = DhKeyExchange.create(out[0..], out, in); + } + } + const end = timer.read(); + + const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; + const throughput = @floatToInt(u64, exchange_count / elapsed_s); + + return throughput; +} + +fn usage() void { + std.debug.warn( + \\throughput_test [options] + \\ + \\Options: + \\ --filter [test-name] + \\ --seed [int] + \\ --help + \\ + ); +} + +fn mode(comptime x: comptime_int) comptime_int { + return if (builtin.mode == builtin.Mode.Debug) x / 64 else x; +} + +// TODO(#1358): Replace with builtin formatted padding when available. +fn printPad(stdout: var, s: []const u8) !void { + var i: usize = 0; + while (i < 12 - s.len) : (i += 1) { + try stdout.print(" "); + } + try stdout.print("{}", s); +} + +pub fn main() !void { + var stdout_file = try std.io.getStdOut(); + var stdout_out_stream = stdout_file.outStream(); + const stdout = &stdout_out_stream.stream; + + var buffer: [1024]u8 = undefined; + var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]); + const args = try std.process.argsAlloc(&fixed.allocator); + + var filter: ?[]u8 = ""; + + var i: usize = 1; + while (i < args.len) : (i += 1) { + if (std.mem.eql(u8, args[i], "--mode")) { + try stdout.print("{}\n", builtin.mode); + return; + } else if (std.mem.eql(u8, args[i], "--seed")) { + i += 1; + if (i == args.len) { + usage(); + std.os.exit(1); + } + + const seed = try std.fmt.parseUnsigned(u32, args[i], 10); + prng.seed(seed); + } else if (std.mem.eql(u8, args[i], "--filter")) { + i += 1; + if (i == args.len) { + usage(); + std.os.exit(1); + } + + filter = args[i]; + } else if (std.mem.eql(u8, args[i], "--help")) { + usage(); + return; + } else { + usage(); + std.os.exit(1); + } + } + + inline for (hashes) |H| { + if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) { + const throughput = try benchmarkHash(H.ty, mode(32 * MiB)); + try printPad(stdout, H.name); + try stdout.print(": {} MiB/s\n", throughput / (1 * MiB)); + } + } + + inline for (macs) |M| { + if (filter == null or std.mem.indexOf(u8, M.name, filter.?) != null) { + const throughput = try benchmarkMac(M.ty, mode(128 * MiB)); + try printPad(stdout, M.name); + try stdout.print(": {} MiB/s\n", throughput / (1 * MiB)); + } + } + + inline for (exchanges) |E| { + if (filter == null or std.mem.indexOf(u8, E.name, filter.?) != null) { + const throughput = try benchmarkKeyExchange(E.ty, mode(1000)); + try printPad(stdout, E.name); + try stdout.print(": {} exchanges/s\n", throughput); + } + } +} diff --git a/std/crypto/blake2.zig b/std/crypto/blake2.zig @@ -269,8 +269,8 @@ pub const Blake2b512 = Blake2b(512); fn Blake2b(comptime out_len: usize) type { return struct { const Self = @This(); - const block_length = 128; - const digest_length = out_len / 8; + pub const block_length = 128; + pub const digest_length = out_len / 8; const iv = [8]u64{ 0x6a09e667f3bcc908, diff --git a/std/crypto/sha2.zig b/std/crypto/sha2.zig @@ -420,8 +420,8 @@ pub const Sha512 = Sha2_64(Sha512Params); fn Sha2_64(comptime params: Sha2Params64) type { return struct { const Self = @This(); - const block_length = 128; - const digest_length = params.out_len / 8; + pub const block_length = 128; + pub const digest_length = params.out_len / 8; s: [8]u64, // Streaming Cache diff --git a/std/crypto/throughput_test.zig b/std/crypto/throughput_test.zig @@ -1,193 +0,0 @@ -const builtin = @import("builtin"); -const std = @import("std"); -const time = std.time; -const Timer = time.Timer; -const crypto = @import("../crypto.zig"); - -const KiB = 1024; -const MiB = 1024 * KiB; - -var prng = std.rand.DefaultPrng.init(0); - -const Crypto = struct { - ty: type, - name: []const u8, -}; - -const hashes = []Crypto{ - Crypto{ .ty = crypto.Md5, .name = "md5" }, - Crypto{ .ty = crypto.Sha1, .name = "sha1" }, - Crypto{ .ty = crypto.Sha256, .name = "sha256" }, - Crypto{ .ty = crypto.Sha512, .name = "sha512" }, - Crypto{ .ty = crypto.Sha3_256, .name = "sha3-256" }, - Crypto{ .ty = crypto.Sha3_512, .name = "sha3-512" }, - Crypto{ .ty = crypto.Blake2s256, .name = "blake2s" }, - Crypto{ .ty = crypto.Blake2b512, .name = "blake2b" }, -}; - -pub fn benchmarkHash(comptime Hash: var, comptime bytes: comptime_int) !u64 { - var h = Hash.init(); - - var block: [Hash.digest_length]u8 = undefined; - prng.random.bytes(block[0..]); - - var offset: usize = 0; - var timer = try Timer.start(); - const start = timer.lap(); - while (offset < bytes) : (offset += block.len) { - h.update(block[0..]); - } - const end = timer.read(); - - const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; - const throughput = @floatToInt(u64, bytes / elapsed_s); - - return throughput; -} - -const macs = []Crypto{ - Crypto{ .ty = crypto.Poly1305, .name = "poly1305" }, - Crypto{ .ty = crypto.HmacMd5, .name = "hmac-md5" }, - Crypto{ .ty = crypto.HmacSha1, .name = "hmac-sha1" }, - Crypto{ .ty = crypto.HmacSha256, .name = "hmac-sha256" }, -}; - -pub fn benchmarkMac(comptime Mac: var, comptime bytes: comptime_int) !u64 { - std.debug.assert(32 >= Mac.mac_length and 32 >= Mac.minimum_key_length); - - var in: [1 * MiB]u8 = undefined; - prng.random.bytes(in[0..]); - - var key: [32]u8 = undefined; - prng.random.bytes(key[0..]); - - var offset: usize = 0; - var timer = try Timer.start(); - const start = timer.lap(); - while (offset < bytes) : (offset += in.len) { - Mac.create(key[0..], in[0..], key); - } - const end = timer.read(); - - const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; - const throughput = @floatToInt(u64, bytes / elapsed_s); - - return throughput; -} - -const exchanges = []Crypto{Crypto{ .ty = crypto.X25519, .name = "x25519" }}; - -pub fn benchmarkKeyExchange(comptime DhKeyExchange: var, comptime exchange_count: comptime_int) !u64 { - std.debug.assert(DhKeyExchange.minimum_key_length >= DhKeyExchange.secret_length); - - var in: [DhKeyExchange.minimum_key_length]u8 = undefined; - prng.random.bytes(in[0..]); - - var out: [DhKeyExchange.minimum_key_length]u8 = undefined; - prng.random.bytes(out[0..]); - - var offset: usize = 0; - var timer = try Timer.start(); - const start = timer.lap(); - { - var i: usize = 0; - while (i < exchange_count) : (i += 1) { - _ = DhKeyExchange.create(out[0..], out, in); - } - } - const end = timer.read(); - - const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; - const throughput = @floatToInt(u64, exchange_count / elapsed_s); - - return throughput; -} - -fn usage() void { - std.debug.warn( - \\throughput_test [options] - \\ - \\Options: - \\ --filter [test-name] - \\ --seed [int] - \\ --help - \\ - ); -} - -fn mode(comptime x: comptime_int) comptime_int { - return if (builtin.mode == builtin.Mode.Debug) x / 64 else x; -} - -// TODO(#1358): Replace with builtin formatted padding when available. -fn printPad(stdout: var, s: []const u8) !void { - var i: usize = 0; - while (i < 12 - s.len) : (i += 1) { - try stdout.print(" "); - } - try stdout.print("{}", s); -} - -pub fn main() !void { - var stdout_file = try std.io.getStdOut(); - var stdout_out_stream = stdout_file.outStream(); - const stdout = &stdout_out_stream.stream; - - var buffer: [1024]u8 = undefined; - var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]); - const args = try std.os.argsAlloc(&fixed.allocator); - - var filter: ?[]u8 = ""; - - var i: usize = 1; - while (i < args.len) : (i += 1) { - if (std.mem.eql(u8, args[i], "--seed")) { - i += 1; - if (i == args.len) { - usage(); - std.os.exit(1); - } - - const seed = try std.fmt.parseUnsigned(u32, args[i], 10); - prng.seed(seed); - } else if (std.mem.eql(u8, args[i], "--filter")) { - i += 1; - if (i == args.len) { - usage(); - std.os.exit(1); - } - - filter = args[i]; - } else if (std.mem.eql(u8, args[i], "--help")) { - usage(); - return; - } else { - usage(); - std.os.exit(1); - } - } - - inline for (hashes) |H| { - if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) { - const throughput = try benchmarkHash(H.ty, mode(32 * MiB)); - try printPad(stdout, H.name); - try stdout.print(": {} MiB/s\n", throughput / (1 * MiB)); - } - } - - inline for (macs) |M| { - if (filter == null or std.mem.indexOf(u8, M.name, filter.?) != null) { - const throughput = try benchmarkMac(M.ty, mode(128 * MiB)); - try printPad(stdout, M.name); - try stdout.print(": {} MiB/s\n", throughput / (1 * MiB)); - } - } - - inline for (exchanges) |E| { - if (filter == null or std.mem.indexOf(u8, E.name, filter.?) != null) { - const throughput = try benchmarkKeyExchange(E.ty, mode(1000)); - try printPad(stdout, E.name); - try stdout.print(": {} exchanges/s\n", throughput); - } - } -} diff --git a/std/hash/benchmark.zig b/std/hash/benchmark.zig @@ -0,0 +1,208 @@ +// zig run benchmark.zig --release-fast --override-std-dir .. + +const builtin = @import("builtin"); +const std = @import("std"); +const time = std.time; +const Timer = time.Timer; +const hash = std.hash; + +const KiB = 1024; +const MiB = 1024 * KiB; +const GiB = 1024 * MiB; + +var prng = std.rand.DefaultPrng.init(0); + +const Hash = struct { + ty: type, + name: []const u8, + init_u8s: ?[]const u8 = null, + init_u64: ?u64 = null, +}; + +const siphash_key = "0123456789abcdef"; + +const hashes = [_]Hash{ + Hash{ .ty = hash.Wyhash, .name = "wyhash", .init_u64 = 0 }, + Hash{ .ty = hash.SipHash64(1, 3), .name = "siphash(1,3)", .init_u8s = siphash_key }, + Hash{ .ty = hash.SipHash64(2, 4), .name = "siphash(2,4)", .init_u8s = siphash_key }, + Hash{ .ty = hash.Fnv1a_64, .name = "fnv1a" }, + Hash{ .ty = hash.Crc32, .name = "crc32" }, +}; + +const Result = struct { + hash: u64, + throughput: u64, +}; + +const block_size: usize = 8192; + +pub fn benchmarkHash(comptime H: var, bytes: usize) !Result { + var h = blk: { + if (H.init_u8s) |init| { + break :blk H.ty.init(init); + } + if (H.init_u64) |init| { + break :blk H.ty.init(init); + } + break :blk H.ty.init(); + }; + + var block: [block_size]u8 = undefined; + prng.random.bytes(block[0..]); + + var offset: usize = 0; + var timer = try Timer.start(); + const start = timer.lap(); + while (offset < bytes) : (offset += block.len) { + h.update(block[0..]); + } + const end = timer.read(); + + const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; + const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); + + return Result{ + .hash = h.final(), + .throughput = throughput, + }; +} + +pub fn benchmarkHashSmallKeys(comptime H: var, key_size: usize, bytes: usize) !Result { + const key_count = bytes / key_size; + var block: [block_size]u8 = undefined; + prng.random.bytes(block[0..]); + + var i: usize = 0; + var timer = try Timer.start(); + const start = timer.lap(); + + var sum: u64 = 0; + while (i < key_count) : (i += 1) { + const o = i % (block_size - key_size); + const small_key = block[o .. key_size + o]; + + const result = blk: { + if (H.init_u8s) |init| { + break :blk H.ty.hash(init, small_key); + } + if (H.init_u64) |init| { + break :blk H.ty.hash(init, small_key); + } + break :blk H.ty.hash(small_key); + }; + + sum +%= result; + } + const end = timer.read(); + + const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; + const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); + + return Result{ + .hash = sum, + .throughput = throughput, + }; +} + +fn usage() void { + std.debug.warn( + \\throughput_test [options] + \\ + \\Options: + \\ --filter [test-name] + \\ --seed [int] + \\ --count [int] + \\ --help + \\ + ); +} + +fn mode(comptime x: comptime_int) comptime_int { + return if (builtin.mode == builtin.Mode.Debug) x / 64 else x; +} + +// TODO(#1358): Replace with builtin formatted padding when available. +fn printPad(stdout: var, s: []const u8) !void { + var i: usize = 0; + while (i < 12 - s.len) : (i += 1) { + try stdout.print(" "); + } + try stdout.print("{}", s); +} + +pub fn main() !void { + var stdout_file = try std.io.getStdOut(); + var stdout_out_stream = stdout_file.outStream(); + const stdout = &stdout_out_stream.stream; + + var buffer: [1024]u8 = undefined; + var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]); + const args = try std.process.argsAlloc(&fixed.allocator); + + var filter: ?[]u8 = ""; + var count: usize = mode(128 * MiB); + var key_size: usize = 32; + + var i: usize = 1; + while (i < args.len) : (i += 1) { + if (std.mem.eql(u8, args[i], "--mode")) { + try stdout.print("{}\n", builtin.mode); + return; + } else if (std.mem.eql(u8, args[i], "--seed")) { + i += 1; + if (i == args.len) { + usage(); + std.os.exit(1); + } + + const seed = try std.fmt.parseUnsigned(u32, args[i], 10); + prng.seed(seed); + } else if (std.mem.eql(u8, args[i], "--filter")) { + i += 1; + if (i == args.len) { + usage(); + std.os.exit(1); + } + + filter = args[i]; + } else if (std.mem.eql(u8, args[i], "--count")) { + i += 1; + if (i == args.len) { + usage(); + std.os.exit(1); + } + + const c = try std.fmt.parseUnsigned(usize, args[i], 10); + count = c * MiB; + } else if (std.mem.eql(u8, args[i], "--key-size")) { + i += 1; + if (i == args.len) { + usage(); + std.os.exit(1); + } + + key_size = try std.fmt.parseUnsigned(usize, args[i], 10); + if (key_size > block_size) { + try stdout.print("key_size cannot exceed block size of {}\n", block_size); + std.os.exit(1); + } + } else if (std.mem.eql(u8, args[i], "--help")) { + usage(); + return; + } else { + usage(); + std.os.exit(1); + } + } + + inline for (hashes) |H| { + if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) { + const result = try benchmarkHash(H, count); + const result_small = try benchmarkHashSmallKeys(H, key_size, count); + + try stdout.print("{}\n", H.name); + try stdout.print(" iterative: {:4} MiB/s [{x:0<16}]\n", result.throughput / (1 * MiB), result.hash); + try stdout.print(" small keys: {:4} MiB/s [{x:0<16}]\n", result_small.throughput / (1 * MiB), result_small.hash); + } + } +} diff --git a/std/hash/throughput_test.zig b/std/hash/throughput_test.zig @@ -1,148 +0,0 @@ -const builtin = @import("builtin"); -const std = @import("std"); -const time = std.time; -const Timer = time.Timer; -const hash = std.hash; - -const KiB = 1024; -const MiB = 1024 * KiB; -const GiB = 1024 * MiB; - -var prng = std.rand.DefaultPrng.init(0); - -const Hash = struct { - ty: type, - name: []const u8, - init_u8s: ?[]const u8 = null, - init_u64: ?u64 = null, -}; - -const siphash_key = "0123456789abcdef"; - -const hashes = [_]Hash{ - Hash{ .ty = hash.Wyhash, .name = "wyhash", .init_u64 = 0 }, - Hash{ .ty = hash.SipHash64(1, 3), .name = "siphash(1,3)", .init_u8s = siphash_key }, - Hash{ .ty = hash.SipHash64(2, 4), .name = "siphash(2,4)", .init_u8s = siphash_key }, - Hash{ .ty = hash.Fnv1a_64, .name = "fnv1a" }, - Hash{ .ty = hash.Crc32, .name = "crc32" }, -}; - -const Result = struct { - hash: u64, - throughput: u64, -}; - -pub fn benchmarkHash(comptime H: var, bytes: usize) !Result { - var h = blk: { - if (H.init_u8s) |init| { - break :blk H.ty.init(init); - } - if (H.init_u64) |init| { - break :blk H.ty.init(init); - } - break :blk H.ty.init(); - }; - - var block: [8192]u8 = undefined; - prng.random.bytes(block[0..]); - - var offset: usize = 0; - var timer = try Timer.start(); - const start = timer.lap(); - while (offset < bytes) : (offset += block.len) { - h.update(block[0..]); - } - const end = timer.read(); - - const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; - const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); - - return Result{ - .hash = h.final(), - .throughput = throughput, - }; -} - -fn usage() void { - std.debug.warn( - \\throughput_test [options] - \\ - \\Options: - \\ --filter [test-name] - \\ --seed [int] - \\ --count [int] - \\ --help - \\ - ); -} - -fn mode(comptime x: comptime_int) comptime_int { - return if (builtin.mode == builtin.Mode.Debug) x / 64 else x; -} - -// TODO(#1358): Replace with builtin formatted padding when available. -fn printPad(stdout: var, s: []const u8) !void { - var i: usize = 0; - while (i < 12 - s.len) : (i += 1) { - try stdout.print(" "); - } - try stdout.print("{}", s); -} - -pub fn main() !void { - var stdout_file = try std.io.getStdOut(); - var stdout_out_stream = stdout_file.outStream(); - const stdout = &stdout_out_stream.stream; - - var buffer: [1024]u8 = undefined; - var fixed = std.heap.FixedBufferAllocator.init(buffer[0..]); - const args = try std.process.argsAlloc(&fixed.allocator); - - var filter: ?[]u8 = ""; - var count: usize = mode(128 * MiB); - - var i: usize = 1; - while (i < args.len) : (i += 1) { - if (std.mem.eql(u8, args[i], "--seed")) { - i += 1; - if (i == args.len) { - usage(); - std.os.exit(1); - } - - const seed = try std.fmt.parseUnsigned(u32, args[i], 10); - prng.seed(seed); - } else if (std.mem.eql(u8, args[i], "--filter")) { - i += 1; - if (i == args.len) { - usage(); - std.os.exit(1); - } - - filter = args[i]; - } else if (std.mem.eql(u8, args[i], "--count")) { - i += 1; - if (i == args.len) { - usage(); - std.os.exit(1); - } - - const c = try std.fmt.parseUnsigned(u32, args[i], 10); - count = c * MiB; - } else if (std.mem.eql(u8, args[i], "--help")) { - usage(); - return; - } else { - usage(); - std.os.exit(1); - } - } - - inline for (hashes) |H| { - if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) { - const result = try benchmarkHash(H, count); - try printPad(stdout, H.name); - try stdout.print(": {:4} MiB/s [{:16}]\n", result.throughput / (1 * MiB), result.hash); - } - } -}