Collect Parcel statistics using std::atomics.
Instead of using a heavy pthread_mutex_t for updating size and count statistics, this change shifts to using faster std::atomic values, an approach that was already pioneered over in hardware::Parcel. The Parcel benchmarks referenced below are showing a ~10% perf improvement for contended cases. Note that this is in addition to the improvements recently made with the shift to a linked-list pooling design, and removal of advisory native allocation updates. Here's the combined improvements of all three changes together; ~2x throughput for the 1-thread case, and ~9x throughput for the 16-thread case. 1 thread 4 threads 16 threads Combined 50.48% 15.58% 11.41% Bug: 165032569 Test: ./frameworks/base/libs/hwui/tests/scripts/prep_generic.sh little && atest CorePerfTests:android.os.ParcelObtainPerfTest Change-Id: I436e70cdfd06e747d5c8fcc0ddd6ecf92737cf9c
Loading
Please register or sign in to comment