commit | d5c4c550e414c0218f9f2c4a44b6fde3f8bb0c0e | [log] [tgz] |
---|---|---|
author | Songchun Fan <schfan@google.com> | Thu May 05 19:13:31 2022 +0000 |
committer | Songchun Fan <schfan@google.com> | Sat May 07 00:02:16 2022 +0000 |
tree | 3f63b9ddb86e3d83be81c2f282e1df5bc4edba2d | |
parent | 455e490d94727a375bb78caba6599dd4248e51f4 [diff] |
[snapshot] optimizing WatchedArrayList snapshot ArrayList.add(index, value) does an array copy everytime to extend the underlying array. Here we already knew the size of that array and ensured the capacity so we should only call ArrayList.add(value) which does not involve array copying. We need to examine other Watched* classes and try to spot performance issues like this. BUG: 231373522 Test: forrest run Change-Id: Iab440fc809072e9b1ee1bef7d69a0dc04207bafb