diff options
author | 2025-01-31 03:27:26 -0800 | |
---|---|---|
committer | 2025-01-31 03:27:26 -0800 | |
commit | 533fa597f960c6e1d39415264704c59a64a188eb (patch) | |
tree | 61d95dca1608c52f151ae16023e0585b1790a27c /libs/androidfw/LocaleDataLookup.cpp | |
parent | 2473478f8080f7994b94162c1948efe1b33ea0bd (diff) | |
parent | d0dde3c3533d2335293a94146bb089a90e50259e (diff) |
Merge "Add benchmarks for LocaleDataLookup" into main
Diffstat (limited to 'libs/androidfw/LocaleDataLookup.cpp')
-rw-r--r-- | libs/androidfw/LocaleDataLookup.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/androidfw/LocaleDataLookup.cpp b/libs/androidfw/LocaleDataLookup.cpp index 6e751a77f355..ea9e9a2d4280 100644 --- a/libs/androidfw/LocaleDataLookup.cpp +++ b/libs/androidfw/LocaleDataLookup.cpp @@ -7518,6 +7518,13 @@ const char* lookupLikelyScript(uint32_t packed_lang_region) { } } +/* + * TODO: Consider turning the below switch statement into binary search + * to save the disk space when the table is larger in the future. + * Disassembled code shows that the jump table emitted by clang can be + * 4x larger than the data in disk size, but it depends on the optimization option. + * However, a switch statement will benefit from the future of compiler improvement. + */ bool isLocaleRepresentative(uint32_t language_and_region, const char* script) { const uint64_t packed_locale = ((static_cast<uint64_t>(language_and_region)) << 32u) | |