Files
frameworks_base/core/java/android
Haoyu Zhang bc317e642c Optimize TextView#populateCharacterBounds
Avoid unnecessary calls of getPrimaryHorizontal/getSecondaryHorizontal,
this will make the method around 2 times faster.
Also avoid repeat calls of isPositionVisible, which reduces the
computation time around 5%.

Before:
	populateCharacterBounds[mTextLength (100))]_min (ns): 416685
	populateCharacterBounds[mTextLength (300))]_min (ns): 1315209
	populateCharacterBounds[mTextLength (1,000))]_min (ns): 4480508
	populateCharacterBounds[mTextLength (3,000))]_min (ns): 13526504
	populateCharacterBounds[mTextLength (10,000))]_min (ns): 44841361

After:
        populateCharacterBounds[mTextLength (100))]_min (ns): 204065
        populateCharacterBounds[mTextLength (300))]_min (ns): 653159
        populateCharacterBounds[mTextLength (1,000))]_min (ns): 2184327
        populateCharacterBounds[mTextLength (3,000))]_min (ns): 6770318
        populateCharacterBounds[mTextLength (10,000))]_min (ns): 22777530

Bug: 233922052
Test: atest android.text.TextViewCursorAnchorInfoPerfTest
Change-Id: I24a470e204e4a2e52f881828c707adfcca21f890
2022-05-26 09:27:32 -07:00
..
…
…
…