Add to_lowercase and to_uppercase char benchmarks
This commit is contained in:
parent
e48c68479e
commit
8acb566507
1 changed files with 10 additions and 0 deletions
|
@ -45,3 +45,13 @@ fn bench_to_ascii_uppercase(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())
|
||||
}
|
||||
|
||||
#[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…
Add table
Reference in a new issue