lib/core: Improve speed of `utf8_length` in NativeString and change signature