]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common: optimize check_utf8 27628/head
authorYibo Cai <yibo.cai@arm.com>
Fri, 12 Apr 2019 07:51:31 +0000 (15:51 +0800)
committerYibo Cai <yibo.cai@arm.com>
Wed, 17 Apr 2019 01:46:45 +0000 (09:46 +0800)
commitc8ebf1a3a4834582e20e7fcc91f136e61ed8b7b7
treee92321bc87617edc9c08ac08d53a51b9ea0a3c26
parente29e2029c3a68f1ed35e20ed04c577f6544b6868
common: optimize check_utf8

Current check_utf8 implementation is not efficient. It first decodes the
string to catch possible errors, then encode the decoded string back and
compare with original string to make sure it's fine.

This patch introduces a straightforward approach to validate utf8 string
directly based on utf8 code spec.

3x ~ 8x performance boost is observed on x86 and Arm.

Signed-off-by: Yibo Cai <yibo.cai@arm.com>
src/common/utf8.c