diff options
author | Bruce Hoult <b.hoult@samsung.com> | 2015-10-28 15:06:12 +0300 |
---|---|---|
committer | Artem Udovichenko <artem.u@samsung.com> | 2015-11-24 13:36:30 +0300 |
commit | 1646d7a22e43a1fb25452ead47a4073e63d7f391 (patch) | |
tree | afa5614a1d262e83b3da57930a5266715e8acd97 /compiler/optimizing/graph_visualizer.cc | |
parent | 0f0d5f370dca8bbdb97c61ea30e1b0476ee7749a (diff) |
Optimize some commonly used utf8 functions by:
- using counted loops instead of searching for terminating null. In
the important cases the caller already knows the length: change
the API to pass it in. Keep the old API version as well to avoid
extensive changes to non-critical debug and test code.
- ensure the common cases are at the start of if/then/else chains.
Usually 99+% of characters are ASCII even in mixed strings.
- for the "convert" functions, when both utf8 and utf16 lengths are
passed, and are equal, it means the entire string is ASCII, and a
specialized loop can be used. The compiler might then unroll or
even vectorize this.
The functions improved are (tested on Nexus 5 with a 44 character
ASCII string):
CountModifiedUtf8Chars : 20% faster
ConvertUtf16ToModifiedUtf8: 80% faster
ConvertModifiedUtf8ToUtf16: 200% faster
Also for completeness CountUtf8Bytes has been cleaned up a little, but
the speed is unchanged. Unlike CountModifiedUtf8Chars, it was already
passed the length, rather than searching for null.
Change-Id: I1c9b7dea3eda869fc9f5f6b4dd6be8cdd5bc3ac0
Diffstat (limited to 'compiler/optimizing/graph_visualizer.cc')
0 files changed, 0 insertions, 0 deletions