chars: probe for a valid UTF-8 starter byte, instead of overstepping
Instead of always stepping back four bytes and then tentatively moving forward again (which is wasteful when most codes are just one or two bytes long), inspect the preceding bytes one by one and begin the move forward at the first valid starter byte. This reduces the backwards searching time by close to 40 percent.
Showing
+14 -2
Please register or sign in to comment