1
Fork 0

Slight perf improvement on char::to_ascii_lowercase

This commit is contained in:
Giles Cope 2021-02-06 19:14:13 +00:00
parent 9a9477fada
commit f165f49d22
No known key found for this signature in database
GPG key ID: DF85161DAE0FF36B
2 changed files with 14 additions and 2 deletions

View file

@ -35,3 +35,13 @@ fn bench_to_digit_radix_var(b: &mut Bencher) {
.min()
})
}
#[bench]
fn bench_to_ascii_uppercase(b: &mut Bencher) {
b.iter(|| CHARS.iter().cycle().take(10_000).map(|c| c.to_ascii_uppercase()).min())
}
#[bench]
fn bench_to_ascii_lowercase(b: &mut Bencher) {
b.iter(|| CHARS.iter().cycle().take(10_000).map(|c| c.to_ascii_lowercase()).min())
}