mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-17 01:13:11 +00:00
Add two more benchmarks for strictly ASCII and non ASCII cases
This commit is contained in:
parent
8acb566507
commit
229fdf839a
@ -47,11 +47,31 @@ fn bench_to_ascii_lowercase(b: &mut Bencher) {
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_char_to_uppercase(b: &mut Bencher) {
|
||||
fn bench_ascii_mix_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) {
|
||||
fn bench_ascii_mix_to_lowercase(b: &mut Bencher) {
|
||||
b.iter(|| (0..=255).cycle().take(10_000).map(|b| char::from(b).to_lowercase()).count())
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_ascii_char_to_uppercase(b: &mut Bencher) {
|
||||
b.iter(|| (0..=127).cycle().take(10_000).map(|b| char::from(b).to_uppercase()).count())
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_ascii_char_to_lowercase(b: &mut Bencher) {
|
||||
b.iter(|| (0..=127).cycle().take(10_000).map(|b| char::from(b).to_lowercase()).count())
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_non_ascii_char_to_uppercase(b: &mut Bencher) {
|
||||
b.iter(|| (128..=255).cycle().take(10_000).map(|b| char::from(b).to_uppercase()).count())
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_non_ascii_char_to_lowercase(b: &mut Bencher) {
|
||||
b.iter(|| (128..=255).cycle().take(10_000).map(|b| char::from(b).to_lowercase()).count())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user