Skip to content

Commit

Permalink
Always use the general case char count
Browse files Browse the repository at this point in the history
  • Loading branch information
diondokter committed May 27, 2024
1 parent a74509c commit d4fb66b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/str/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d4fb66b

Please sign in to comment.