diff options
| author | Dion Dokter <diondokter@gmail.com> | 2024-05-27 12:05:00 +0200 |
|---|---|---|
| committer | Dion Dokter <diondokter@gmail.com> | 2024-05-27 12:05:00 +0200 |
| commit | 05fa647dc7810a756a206d2300f12b3dafec779f (patch) | |
| tree | 4f892f15d64f6e1875404765f584711ecd4134c6 | |
| parent | cdc509f7c09361466d543fc8311ce7066b10cc4f (diff) | |
Always use the general case char count
| -rw-r--r-- | library/core/src/str/count.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/str/count.rs b/library/core/src/str/count.rs index 28567a7e753..d8667864fe5 100644 --- a/library/core/src/str/count.rs +++ b/library/core/src/str/count.rs @@ -24,7 +24,7 @@ const UNROLL_INNER: usize = 4; #[inline] pub(super) fn count_chars(s: &str) -> usize { - if s.len() < USIZE_SIZE * UNROLL_INNER { + if cfg!(feature = "optimize_for_size") || s.len() < USIZE_SIZE * UNROLL_INNER { // Avoid entering the optimized implementation for strings where the // difference is not likely to matter, or where it might even be slower. // That said, a ton of thought was not spent on the particular threshold |
