summaryrefslogtreecommitdiff
path: root/rs/java/android/renderscript/ProgramFragmentFixedFunction.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2020-11-06 20:40:59 -0700
committerJeff Sharkey <jsharkey@android.com>2020-11-09 17:22:03 -0700
commit7a38dcc93891862586b40d98c7f7851cbd1a0d00 (patch)
treee5a5fd7e30212413f3b10fc3f10af4c6788819a6 /rs/java/android/renderscript/ProgramFragmentFixedFunction.java
parent32d2258c24799c92c3826bdfe96b277c440fdb89 (diff)
CharsetUtils alternatives that avoid allocations.
Internally String.getBytes() calls libcore.util.CharsetUtils methods for a handful of common charsets, but that path requires new memory allocations for every call. This change introduces alternative versions of those methods which attempt to encode data directly into an already-allocated memory region. If the destination is to small, callers can detect and pivot back to calling String.getBytes(). The included benchmarks reveal these raw performance improvements, in addition to the reduced GC load which is harder to measure: timeLocal_LargeBuffer[simple]_mean: 424 timeLocal_SmallBuffer[simple]_mean: 511 timeUpstream[simple]_mean: 800 timeLocal_LargeBuffer[complex]_mean: 977 timeLocal_SmallBuffer[complex]_mean: 1266 timeUpstream[complex]_mean: 1468 Bug: 171832118 Test: atest CorePerfTests:android.util.CharsetUtilsPerfTest Test: atest FrameworksCoreTests:android.util.CharsetUtilsTest Change-Id: Iac1151e7cb8e88bf82339cada64b0936e1a7578b
Diffstat (limited to 'rs/java/android/renderscript/ProgramFragmentFixedFunction.java')
0 files changed, 0 insertions, 0 deletions