Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bytes_from_utf8: Copy initial invariants as-is
The paradigm used in this commit is in place in several other places in core. When dealing with UTF-8, it may well be that the first part of a string contains only characters that are the same when encoded as UTF-8 as when not. There is a function that finds the first position in a string not like that. It works on a whole word at a time instead of per-byte, effectively speeding things up by a factor of 8. In this case, calling that function tells us that we can use memcpy() to do the initial part of our task, before having to switch to looking at individual bytes.
- Loading branch information