Making Unicode things fast

By &ldquo;Unicode things&rdquo; I mean programs that process UTF-8.&#xA;The basic logic of such programs is typically: