Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › crypto/ › benchmark.zig › benchmarkHashParallel
benchmarkHashParallel
benchmark.benchmarkHashParallel
pub fn benchmarkHashParallel (comptime Hash : anytype , comptime bytes : comptime_int , allocator : mem .Allocator , io : std .Io ) !u64
File
Code
pub fn benchmarkHashParallel (comptime Hash : anytype , comptime bytes : comptime_int , allocator : mem .Allocator , io : std .Io ) !u64 {
const data : []u8 = try allocator .alloc (u8 , bytes );
defer allocator .free (data );
random .bytes (data );
const start = benchTime (io );
var final : [Hash .digest_length ]u8 = undefined ;
try Hash .hashParallel (data , &final , .{}, allocator , io );
std .mem .doNotOptimizeAway (final );
const end = benchTime (io );
const elapsed_s = @as (f64 , @floatFromInt (end - start )) / time .ns_per_s ;
const throughput = @as (u64 , @intFromFloat (bytes / elapsed_s ));
return throughput ;
}