Kweku Adams
6a97c5d9f5
Improve replaceAll.
The default implementation of Map.replaceAll() iterates through the
entrySet. Switch to a simple for loop iterating through the array
since the iterator is an inefficient way to access the array contents.
Benchmark results:
Before:
android.util.ArrayMapPerfTest#testReplaceAll_Large:
replaceAll_Large_min (ns): 888977
replaceAll_Large_median (ns): 904642
replaceAll_Large_mean (ns): 914596
replaceAll_Large_standardDeviation: 23960
android.util.ArrayMapPerfTest#testReplaceAll_Small:
replaceAll_Small_min (ns): 177767
replaceAll_Small_median (ns): 179955
replaceAll_Small_mean (ns): 180331
replaceAll_Small_standardDeviation: 2865
After:
android.util.ArrayMapPerfTest#testReplaceAll_Large:
replaceAll_Large_min (ns): 557385
replaceAll_Large_median (ns): 586495
replaceAll_Large_mean (ns): 583712
replaceAll_Large_standardDeviation: 20356
android.util.ArrayMapPerfTest#testReplaceAll_Small:
replaceAll_Small_min (ns): 108051
replaceAll_Small_median (ns): 110802
replaceAll_Small_mean (ns): 109987
replaceAll_Small_standardDeviation: 1334
Bug: 194098491
Test: atest CorePerfTests:ArrayMapPerfTest (see results above)
Test: atest CtsUtilTestCases:ArrayMapTest
Test: atest FrameworksCoreTests:ArrayMapTest
Change-Id: If87ae5f3aa4b184b95c16aed5f2fb6f31d11668a
2021-09-10 14:33:40 -07:00
..
2021-09-03 18:29:46 +00:00
2020-12-08 11:01:05 -07:00
2021-09-10 14:33:40 -07:00
2021-07-19 13:10:23 -07:00
2020-11-13 14:11:41 -07:00
2020-12-01 10:34:22 -08:00
2021-08-25 15:59:09 +08:00
2020-11-04 09:45:53 +00:00
2020-12-10 18:57:17 -08:00
2021-08-17 22:43:10 +08:00
2020-11-04 09:45:53 +00:00
2021-04-29 14:09:18 +01:00
2020-11-04 09:45:53 +00:00
2020-11-04 09:45:53 +00:00
2020-11-04 09:45:53 +00:00
2021-02-24 23:33:16 +08:00
2020-11-04 09:45:53 +00:00
2021-03-02 18:38:57 +00:00
2021-04-22 19:15:40 +00:00
2020-11-04 09:45:53 +00:00
2020-12-24 17:41:19 +00:00
2020-11-04 09:45:53 +00:00
2020-11-04 09:45:53 +00:00
2021-02-23 17:34:26 -08:00
2021-03-04 23:27:08 +00:00
2021-04-06 22:53:25 -07:00
2021-02-24 12:58:06 -08:00
2021-08-23 09:50:11 -07:00
2021-03-19 17:31:56 -07:00
2021-03-17 18:43:19 -07:00
2021-03-31 17:03:40 +00:00
2020-11-04 09:45:53 +00:00
2021-01-07 14:30:57 -05:00
2020-12-09 12:18:05 -07:00
2020-11-16 14:43:29 -07:00
2020-12-17 08:16:32 -07:00