From d4fb66bf7aa7189c85945cd8b7d4db2bccbc1130 Mon Sep 17 00:00:00 2001 From: Dion Dokter Date: Mon, 27 May 2024 12:05:00 +0200 Subject: [PATCH] Always use the general case char count --- core/src/str/count.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/str/count.rs b/core/src/str/count.rs index 28567a7e753aa..d8667864fe554 100644 --- a/core/src/str/count.rs +++ b/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