Expand description
Library for counting length of chars faster than chars()
.count()
use faster_chars_count::*;
let a = "rust=錆;rust=錆;rust=錆;rust=錆;rust=錆;";
assert_eq!(a.chars().count(), chars_count_str(a));
assert_eq!(a.chars().count(), a.chars_count());
Idea is that we only needs to count the byte witch is not a continuation byte. This can be done at the same time for 4byte (u64
) or 32byte (__m256i
with avx2).
Traits§
- Chars
Count - Trait for counting chars faster than
chars()
.count()
Functions§
- chars_
count_ byte - Function version of faster
chars_count()
for&[u8]
- chars_
count_ str - Function version of faster
chars_count()