2c96639eb2
From a logcat profile: ``` |--95.06%-- convertPrintable(char*, char const*, unsigned long) | |--13.95%-- [hit in function] | | | |--35.96%-- mbrtoc32 | | |--82.72%-- [hit in function] | | | | | |--11.07%-- mbsinit | | | | | |--5.96%-- @plt ``` I think we'd assumed that mbsinit() would be inlined, but since these functions aren't all in wchar.cpp it wasn't being. This change moves the implementation into a (more clearly named) inline function so we can trivially reclaim that 11%+6%. Benchmarks before: ``` ------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------- BM_stdlib_mbrtowc_1 8.03 ns 7.95 ns 87144997 BM_stdlib_mbrtowc_2 22.0 ns 21.8 ns 32002437 BM_stdlib_mbrtowc_3 30.0 ns 29.7 ns 23517699 BM_stdlib_mbrtowc_4 37.4 ns 37.1 ns 18895204 BM_stdlib_mbstowcs_ascii 792373 ns 782484 ns 890 bytes_per_second=609.389M/s BM_stdlib_mbstowcs_wide 15836785 ns 15678316 ns 44 bytes_per_second=30.4138M/s ``` Benchmarks after: ``` ------------------------------------------------------------------- Benchmark Time CPU Iterations ------------------------------------------------------------------- BM_stdlib_mbrtowc_1 5.76 ns 5.72 ns 121863813 BM_stdlib_mbrtowc_2 17.1 ns 16.9 ns 41487260 BM_stdlib_mbrtowc_3 24.2 ns 24.0 ns 29141629 BM_stdlib_mbrtowc_4 30.3 ns 30.1 ns 23229291 BM_stdlib_mbstowcs_ascii 783506 ns 775389 ns 903 bytes_per_second=614.965M/s BM_stdlib_mbstowcs_wide 12787003 ns 12672642 ns 55 bytes_per_second=37.6273M/s ``` Bug: http://b/206523398 Test: treehugger Change-Id: If8c6c39880096ddd2cbd323c68dca82e9849ace6 |
||
---|---|---|
.. | ||
arch-arm | ||
arch-arm64 | ||
arch-common/bionic | ||
arch-x86 | ||
arch-x86_64 | ||
async_safe | ||
bionic | ||
dns | ||
fts/include | ||
include | ||
kernel | ||
malloc_debug | ||
malloc_hooks | ||
platform | ||
private | ||
seccomp | ||
stdio | ||
system_properties | ||
tools | ||
tzcode | ||
upstream-freebsd | ||
upstream-netbsd | ||
upstream-openbsd | ||
versioner-dependencies | ||
Android.bp | ||
fs_config_generator.py | ||
libc.map.txt | ||
libstdc++.map.txt | ||
MODULE_LICENSE_BSD | ||
NOTICE | ||
SECCOMP_ALLOWLIST_APP.TXT | ||
SECCOMP_ALLOWLIST_COMMON.TXT | ||
SECCOMP_ALLOWLIST_SYSTEM.TXT | ||
SECCOMP_BLOCKLIST_APP.TXT | ||
SECCOMP_BLOCKLIST_COMMON.TXT | ||
SECCOMP_PRIORITY.TXT | ||
SYSCALLS.TXT | ||
version_script.txt |