summaryrefslogtreecommitdiffstats
path: root/vendor/base64/benches
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/base64/benches')
-rw-r--r--vendor/base64/benches/benchmarks.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/vendor/base64/benches/benchmarks.rs b/vendor/base64/benches/benchmarks.rs
index 61d542f36..802c8cca9 100644
--- a/vendor/base64/benches/benchmarks.rs
+++ b/vendor/base64/benches/benchmarks.rs
@@ -39,8 +39,7 @@ fn do_decode_bench_slice(b: &mut Bencher, &size: &usize) {
fill(&mut v);
let encoded = STANDARD.encode(&v);
- let mut buf = Vec::new();
- buf.resize(size, 0);
+ let mut buf = vec![0; size];
b.iter(|| {
STANDARD.decode_slice(&encoded, &mut buf).unwrap();
black_box(&buf);
@@ -52,8 +51,7 @@ fn do_decode_bench_stream(b: &mut Bencher, &size: &usize) {
fill(&mut v);
let encoded = STANDARD.encode(&v);
- let mut buf = Vec::new();
- buf.resize(size, 0);
+ let mut buf = vec![0; size];
buf.truncate(0);
b.iter(|| {
@@ -96,9 +94,8 @@ fn do_encode_bench_reuse_buf(b: &mut Bencher, &size: &usize) {
fn do_encode_bench_slice(b: &mut Bencher, &size: &usize) {
let mut v: Vec<u8> = Vec::with_capacity(size);
fill(&mut v);
- let mut buf = Vec::new();
// conservative estimate of encoded size
- buf.resize(v.len() * 2, 0);
+ let mut buf = vec![0; v.len() * 2];
b.iter(|| STANDARD.encode_slice(&v, &mut buf).unwrap());
}