From 78b008a062cc50ee5a2110b69a4d6c5f24aa9a9f Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Fri, 14 Feb 2020 12:47:13 -0500 Subject: [PATCH] fix: Use size_of T instead of hardcoded 8 --- benches/encoders.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/benches/encoders.rs b/benches/encoders.rs index c290ec629c..e42fcb167b 100644 --- a/benches/encoders.rs +++ b/benches/encoders.rs @@ -2,6 +2,7 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Through use rand::{distributions::Uniform, Rng}; use std::convert::TryFrom; +use std::mem; mod fixtures; @@ -37,7 +38,9 @@ fn benchmark_encode( ) { let mut group = c.benchmark_group(benchmark_group_name); for &batch_size in batch_sizes { - group.throughput(Throughput::Bytes(u64::try_from(batch_size).unwrap() * 8)); + group.throughput(Throughput::Bytes( + u64::try_from(batch_size * mem::size_of::()).unwrap(), + )); group.bench_with_input( BenchmarkId::from_parameter(batch_size), &batch_size,