Skip to content

Commit 59225b7

Browse files
Merge pull request #156 from marshallpierce/mp/update-msrv
Update MSRV to 1.36.0
2 parents a3d7c06 + 550e4cd commit 59225b7

File tree

6 files changed

+52
-41
lines changed

6 files changed

+52
-41
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sudo: required
55

66
matrix:
77
include:
8-
- rust: 1.34.0
8+
- rust: 1.36.0
99
# cfg(doctest) is experimental in 1.39 but ignored with 1.34.0, and that snuck in when 1.39.0 wasn't tested
1010
- rust: 1.39.0
1111
- rust: stable
@@ -34,11 +34,11 @@ env:
3434
- TERM=dumb
3535

3636
script:
37+
- cargo build --all-targets
3738
- cargo build --verbose $TARGET --no-default-features
3839
- cargo build --verbose $TARGET $FEATURES
3940
- 'if [[ -z "$TARGET" ]]; then cargo test --verbose; fi'
4041
- 'if [[ -z "$TARGET" ]]; then cargo doc --verbose; fi'
41-
- 'if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then cargo bench --no-run; fi'
4242
# run for just a second to confirm that it can build and run ok
4343
- 'if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then cargo fuzz list | xargs -L 1 -I FUZZER cargo fuzz run FUZZER -- -max_total_time=1; fi'
4444

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ harness = false
1717

1818
[dev-dependencies]
1919
# 0.3.3 requires rust 1.36.0 for stable copied()
20-
criterion = "=0.3.2"
20+
criterion = "0.3.4"
2121
rand = "0.6.1"
22-
structopt = "0.3"
22+
structopt = "0.3.21"
2323

2424
[features]
2525
default = ["std"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ See the [docs](https://docs.rs/base64) for all the details.
3333
Rust version compatibility
3434
---
3535

36-
The minimum required Rust version is 1.34.0.
36+
The minimum required Rust version is 1.36.0.
3737

3838
# Contributing
3939

RELEASE-NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.14.0
2+
3+
- MSRV is now 1.36.0
4+
15
# 0.13.0
26

37
- Config methods are const

benches/benchmarks.rs

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use base64::{
99
write, Config,
1010
};
1111

12-
use criterion::{black_box, Bencher, Criterion, ParameterizedBenchmark, Throughput};
12+
use criterion::{black_box, Bencher, Criterion, Throughput, BenchmarkId};
1313
use rand::{FromEntropy, Rng};
1414
use std::io::{self, Read, Write};
1515

@@ -164,46 +164,53 @@ const BYTE_SIZES: [usize; 5] = [3, 50, 100, 500, 3 * 1024];
164164
// keep the benchmark runtime reasonable.
165165
const LARGE_BYTE_SIZES: [usize; 3] = [3 * 1024 * 1024, 10 * 1024 * 1024, 30 * 1024 * 1024];
166166

167-
fn encode_benchmarks(byte_sizes: &[usize]) -> ParameterizedBenchmark<usize> {
168-
ParameterizedBenchmark::new("encode", do_encode_bench, byte_sizes.iter().cloned())
167+
fn encode_benchmarks(c: &mut Criterion, label: &str, byte_sizes: &[usize]) {
168+
let mut group = c.benchmark_group(label);
169+
group
169170
.warm_up_time(std::time::Duration::from_millis(500))
170-
.measurement_time(std::time::Duration::from_secs(3))
171-
.throughput(|s| Throughput::Bytes(*s as u64))
172-
.with_function("encode_display", do_encode_bench_display)
173-
.with_function("encode_reuse_buf", do_encode_bench_reuse_buf)
174-
.with_function("encode_slice", do_encode_bench_slice)
175-
.with_function("encode_reuse_buf_stream", do_encode_bench_stream)
176-
.with_function("encode_string_stream", do_encode_bench_string_stream)
177-
.with_function(
178-
"encode_string_reuse_buf_stream",
179-
do_encode_bench_string_reuse_buf_stream,
180-
)
181-
}
171+
.measurement_time(std::time::Duration::from_secs(3));
172+
173+
for size in byte_sizes {
174+
group
175+
.throughput(Throughput::Bytes(*size as u64))
176+
.bench_with_input(BenchmarkId::new("encode", size), size, do_encode_bench)
177+
.bench_with_input(BenchmarkId::new("encode_display", size), size, do_encode_bench_display)
178+
.bench_with_input(BenchmarkId::new("encode_reuse_buf", size), size, do_encode_bench_reuse_buf)
179+
.bench_with_input(BenchmarkId::new("encode_slice", size), size, do_encode_bench_slice)
180+
.bench_with_input(BenchmarkId::new("encode_reuse_buf_stream", size), size, do_encode_bench_stream)
181+
.bench_with_input(BenchmarkId::new("encode_string_stream", size), size, do_encode_bench_string_stream)
182+
.bench_with_input(
183+
BenchmarkId::new("encode_string_reuse_buf_stream", size),
184+
size,
185+
do_encode_bench_string_reuse_buf_stream,
186+
);
187+
}
182188

183-
fn decode_benchmarks(byte_sizes: &[usize]) -> ParameterizedBenchmark<usize> {
184-
ParameterizedBenchmark::new("decode", do_decode_bench, byte_sizes.iter().cloned())
185-
.warm_up_time(std::time::Duration::from_millis(500))
186-
.measurement_time(std::time::Duration::from_secs(3))
187-
.throughput(|s| Throughput::Bytes(*s as u64))
188-
.with_function("decode_reuse_buf", do_decode_bench_reuse_buf)
189-
.with_function("decode_slice", do_decode_bench_slice)
190-
.with_function("decode_stream", do_decode_bench_stream)
189+
group.finish();
191190
}
192191

193-
fn bench(c: &mut Criterion) {
194-
c.bench("bench_small_input", encode_benchmarks(&BYTE_SIZES[..]));
195-
196-
c.bench(
197-
"bench_large_input",
198-
encode_benchmarks(&LARGE_BYTE_SIZES[..]).sample_size(10),
199-
);
192+
fn decode_benchmarks(c: &mut Criterion, label: &str, byte_sizes: &[usize]) {
193+
let mut group = c.benchmark_group(label);
194+
195+
for size in byte_sizes {
196+
group
197+
.warm_up_time(std::time::Duration::from_millis(500))
198+
.measurement_time(std::time::Duration::from_secs(3))
199+
.throughput(Throughput::Bytes(*size as u64))
200+
.bench_with_input(BenchmarkId::new("decode", size), size, do_decode_bench)
201+
.bench_with_input(BenchmarkId::new("decode_reuse_buf", size), size, do_decode_bench_reuse_buf)
202+
.bench_with_input(BenchmarkId::new("decode_slice", size), size, do_decode_bench_slice)
203+
.bench_with_input(BenchmarkId::new("decode_stream", size), size, do_decode_bench_stream);
204+
}
200205

201-
c.bench("bench_small_input", decode_benchmarks(&BYTE_SIZES[..]));
206+
group.finish();
207+
}
202208

203-
c.bench(
204-
"bench_large_input",
205-
decode_benchmarks(&LARGE_BYTE_SIZES[..]).sample_size(10),
206-
);
209+
fn bench(c: &mut Criterion) {
210+
encode_benchmarks(c, "encode_small_input", &BYTE_SIZES[..]);
211+
encode_benchmarks(c, "encode_large_input", &LARGE_BYTE_SIZES[..]);
212+
decode_benchmarks(c, "decode_small_input", &BYTE_SIZES[..]);
213+
decode_benchmarks(c, "decode_large_input", &LARGE_BYTE_SIZES[..]);
207214
}
208215

209216
criterion_group!(benches, bench);

src/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::{Config, PAD_BYTE};
21
#[cfg(any(feature = "alloc", feature = "std", test))]
32
use crate::{chunked_encoder, STANDARD};
3+
use crate::{Config, PAD_BYTE};
44
#[cfg(any(feature = "alloc", feature = "std", test))]
55
use alloc::{string::String, vec};
66
use core::convert::TryInto;

0 commit comments

Comments
 (0)