(s: &Wtf8)
| 8 | |
| 9 | #[inline] |
| 10 | pub(super) fn count_chars(s: &Wtf8) -> usize { |
| 11 | if s.len() < USIZE_SIZE * UNROLL_INNER { |
| 12 | // Avoid entering the optimized implementation for strings where the |
| 13 | // difference is not likely to matter, or where it might even be slower. |
| 14 | // That said, a ton of thought was not spent on the particular threshold |
| 15 | // here, beyond "this value seems to make sense". |
| 16 | char_count_general_case(s.as_bytes()) |
| 17 | } else { |
| 18 | do_count_chars(s) |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | fn do_count_chars(s: &Wtf8) -> usize { |
| 23 | // For correctness, `CHUNK_SIZE` must be: |
no test coverage detected