diff options
| author | 2024-01-29 17:33:48 -0800 | |
|---|---|---|
| committer | 2024-01-30 16:13:51 -0800 | |
| commit | 7c19b3cc10b662ecf42561f1013ecb5b53cd46c3 (patch) | |
| tree | 3e45027c4abca1f4f656f640c1bd1b7f9863173d /libs/hwui/FrameInfoVisualizer.cpp | |
| parent | d3ca7f8aea50c59d83bb28a5de7ba3b025b4fedd (diff) | |
[res] Speed up a check of a resource name for int
Resources.getIdentifier(name) and Resources.getValue(name) both
first check if the passed name is actually an ID in a string
form, and does it with Integer.parseInt(). Most of the time it
isn't, and that's reported via Java exception. So the most
common use case involves an exception on a regular path.
This change adds a simple check to filter out all names that
don't look like a number, and only try parsing those that are
'int-like', i.e. <=10 digits. This speeds up the calls by more
than 2x, and gets rid of most of heap usages
Bug: 282215580
Test: build + presubmits
Change-Id: I1cd6be728f4e4bec04cb97729911c6a3fae0d010
Diffstat (limited to 'libs/hwui/FrameInfoVisualizer.cpp')
0 files changed, 0 insertions, 0 deletions