about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMiccah Castorina <m.castorina93@gmail.com>2021-01-24 20:29:44 -0600
committerMiccah Castorina <m.castorina93@gmail.com>2021-02-26 11:41:37 -0600
commit8acb5665072f499effeb77eb2c60fd9cf74a2955 (patch)
tree45122a350bdf84693c7c1b7d73442de94754c4cb
parente48c68479eb9f898154843dd2ae291d53df952a3 (diff)
Add to_lowercase and to_uppercase char benchmarks
-rw-r--r--library/core/benches/char/methods.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/library/core/benches/char/methods.rs b/library/core/benches/char/methods.rs
index de4b63030fa..749cf979fad 100644
--- a/library/core/benches/char/methods.rs
+++ b/library/core/benches/char/methods.rs
@@ -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())
+}