Crate faster_chars_count[−][src]
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 from UTF-8のコードポイントはどうやって高速に数えるか, and UTF-8のコードポイントはどうやってもっと高速に数えるか.
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
CharsCount |
Functions
chars_count_byte | Function version of faster |
chars_count_str | Function version of faster |