Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 52c2cab4 authored by Tim Murray's avatar Tim Murray
Browse files

libui: rewrite Region with FatVector

Region is heavily used by SurfaceFlinger and the Android animation
framework, but it uses the libutils Vector internally. libutils Vector
allocates four elements via malloc() regardless of the contents of the
Vector. However, Region is overwhelmingly a single-element Vector
(occasionally two), which can be allocated on the stack easily enough.

FatVector is an existing wrapper around std::vector that allows for a
stack-allocated vector when the contents are small enough. Using
FatVector in Region instead of libutils Vector avoids all of the
malloc/free overhead, which improves SurfaceFlinger per-frame runtime
by ~4%.

This CL moves FatVector from libhwui to make it usable by Region.

Test: boots, works, passes tests
Bug: 149096186

Change-Id: I265c6c831bc82f31afe0d100aec2f98344f2390b
parent 5a377dd1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment