>I'm pretty confident this improvement is architecture-independent. Thanks for testing it with different architectures.
It looks like the same utf8_advance function is good for both fast-path and for the slow path. Then pg_utf8_verifychar could be removed altogether along with the corresponding IS_*_BYTE_LEAD macros. Vladimir