diff options
| -rw-r--r-- | library/core/benches/char/methods.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/library/core/benches/char/methods.rs b/library/core/benches/char/methods.rs index 749cf979fad..9408f83c32f 100644 --- a/library/core/benches/char/methods.rs +++ b/library/core/benches/char/methods.rs @@ -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()) +} |
