diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2020-11-04 20:42:55 -0700 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2020-11-05 09:22:35 -0700 |
| commit | 88e8d72a75b31618576039c9376150a4dbadf339 (patch) | |
| tree | 67e11241b95100b9fdefd86a0e1f2506165208e2 /opengl/tests/gl_basic/gl_basic.cpp | |
| parent | 494b0901856af9b0e95d058db049c8b31fd52dd5 (diff) | |
Double speed of Parcel.writeString().
Previous logic was using GetStringUTFChars() and GetStringCritical(),
which resulted in making a new temporary heap allocation and an extra
memcpy(). The new approach in this CL bypasses those operations by
asking the JNI helpers to copy directly into the Parcel buffer.
This does mean that the contract for writing strings (prefixed with
length) is now duplicated in Parcel.cpp and android_os_Parcel.cpp,
so we leave docs to ensure future maintainers keep them in sync.
Benchmarking shows that this change improves performance by ~36%
for UTF-8 strings and ~52% for UTF-16 strings:
Before:
timeWriteString8[simple]_mean: 1323
timeWriteString8[complex]_mean: 2103
timeWriteString16[simple]_mean: 1427
timeWriteString16[complex]_mean: 1368
After:
timeWriteString8[simple]_mean: 846
timeWriteString8[complex]_mean: 1671
timeWriteString16[simple]_mean: 685
timeWriteString16[complex]_mean: 748
Bug: 172562452
Test: atest CorePerfTests:android.os.ParcelStringPerfTest
Change-Id: Ibacce2547ecc7a050b698cee8aa5b4e3bc45956f
Diffstat (limited to 'opengl/tests/gl_basic/gl_basic.cpp')
0 files changed, 0 insertions, 0 deletions
