mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
Make clippy happier with vec initialization in blobstore benchmark
Summary: It says I was doing it the slow way. Do it the fast way Reviewed By: krallin Differential Revision: D20926911 fbshipit-source-id: 65790d510d626e70a402c22a2df5d7606427aa7f
This commit is contained in:
parent
10a1fc24b7
commit
e58925a771
@ -30,10 +30,10 @@ mod single_gets;
|
||||
|
||||
pub const KB: usize = 1024;
|
||||
pub const MB: usize = KB * 1024;
|
||||
const ARG_STORAGE_CONFIG_NAME: &'static str = "storage-config-name";
|
||||
const ARG_SAVE_BASELINE: &'static str = "save-baseline";
|
||||
const ARG_USE_BASELINE: &'static str = "use-baseline";
|
||||
const ARG_FILTER_BENCHMARKS: &'static str = "filter";
|
||||
const ARG_STORAGE_CONFIG_NAME: &str = "storage-config-name";
|
||||
const ARG_SAVE_BASELINE: &str = "save-baseline";
|
||||
const ARG_USE_BASELINE: &str = "use-baseline";
|
||||
const ARG_FILTER_BENCHMARKS: &str = "filter";
|
||||
|
||||
const BLOBSTORE_BLOBS_CACHE_POOL: &str = "blobstore-blobs";
|
||||
const BLOBSTORE_PRESENCE_CACHE_POOL: &str = "blobstore-presence";
|
||||
|
@ -38,8 +38,7 @@ pub fn benchmark(
|
||||
let keys: Vec<_> = repeat(())
|
||||
.take(*concurrency)
|
||||
.map(|()| {
|
||||
let mut block = Vec::with_capacity(size);
|
||||
block.resize(size, 0u8);
|
||||
let mut block = vec![0; size];
|
||||
thread_rng().fill(&mut block as &mut [u8]);
|
||||
|
||||
let block = BlobstoreBytes::from_bytes(block);
|
||||
|
@ -38,8 +38,7 @@ pub fn benchmark(
|
||||
let blocks: Vec<_> = std::iter::repeat(())
|
||||
.take(*concurrency)
|
||||
.map(|()| {
|
||||
let mut block = Vec::with_capacity(size);
|
||||
block.resize(size, 0u8);
|
||||
let mut block = vec![0; size];
|
||||
thread_rng().fill(&mut block as &mut [u8]);
|
||||
|
||||
BlobstoreBytes::from_bytes(block)
|
||||
|
@ -35,8 +35,7 @@ pub fn benchmark(
|
||||
BenchmarkId::from_parameter(format!("{} x{}", size, concurrency)),
|
||||
size,
|
||||
|b, &size| {
|
||||
let mut block = Vec::with_capacity(size);
|
||||
block.resize(size, 0u8);
|
||||
let mut block = vec![0; size];
|
||||
thread_rng().fill(&mut block as &mut [u8]);
|
||||
|
||||
let block = BlobstoreBytes::from_bytes(block);
|
||||
|
@ -28,8 +28,7 @@ pub fn benchmark(
|
||||
for size in [128, 16 * KB, 512 * KB, 8 * MB].iter() {
|
||||
group.throughput(Throughput::Bytes(*size as u64));
|
||||
group.bench_with_input(BenchmarkId::from_parameter(size), size, |b, &size| {
|
||||
let mut block = Vec::with_capacity(size);
|
||||
block.resize(size, 0u8);
|
||||
let mut block = vec![0; size];
|
||||
thread_rng().fill(&mut block as &mut [u8]);
|
||||
|
||||
let block = BlobstoreBytes::from_bytes(block);
|
||||
|
@ -28,8 +28,7 @@ pub fn benchmark(
|
||||
for size in [128, 16 * KB, 512 * KB, 8 * MB].iter() {
|
||||
group.throughput(Throughput::Bytes(*size as u64));
|
||||
group.bench_with_input(BenchmarkId::from_parameter(size), size, |b, &size| {
|
||||
let mut block = Vec::with_capacity(size);
|
||||
block.resize(size, 0u8);
|
||||
let mut block = vec![0; size];
|
||||
thread_rng().fill(&mut block as &mut [u8]);
|
||||
|
||||
let block = BlobstoreBytes::from_bytes(block);
|
||||
|
Loading…
Reference in New Issue
Block a user