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 cdc509f commit 05fa647
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/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 05fa647

Please sign in to comment.