mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 09:04:18 +00:00
Add to_lowercase and to_uppercase char benchmarks
This commit is contained in:
parent
e48c68479e
commit
8acb566507
@ -45,3 +45,13 @@ fn bench_to_ascii_uppercase(b: &mut Bencher) {
|
|||||||
fn bench_to_ascii_lowercase(b: &mut Bencher) {
|
fn bench_to_ascii_lowercase(b: &mut Bencher) {
|
||||||
b.iter(|| CHARS.iter().cycle().take(10_000).map(|c| c.to_ascii_lowercase()).min())
|
b.iter(|| CHARS.iter().cycle().take(10_000).map(|c| c.to_ascii_lowercase()).min())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[bench]
|
||||||
|
fn bench_char_to_uppercase(b: &mut Bencher) {
|
||||||
|
b.iter(|| (0..=255).cycle().take(10_000).map(|b| char::from(b).to_uppercase()).count())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[bench]
|
||||||
|
fn bench_char_to_lowercase(b: &mut Bencher) {
|
||||||
|
b.iter(|| (0..=255).cycle().take(10_000).map(|b| char::from(b).to_lowercase()).count())
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user