Using a function that operates on ranges instead of the lookup table makes BLI_strncpy_utf8 around 2.8x faster in my tests.