Commit 508b152
Avoid array copies on every MapBuffer read (#52386)
Summary:
Pull Request resolved: #52386
Enum `values()` function makes a copy of an underlying array on each call. This happens in a hot path, and seems to show up during profiling. Let's cache it.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D77623705
fbshipit-source-id: 5a33425822f477f63fe104ca9e5ed474385a20221 parent 0d455f3 commit 508b152
1 file changed
Lines changed: 14 additions & 2 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
| |||
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
267 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
268 | 278 | | |
269 | 279 | | |
270 | 280 | | |
| |||
318 | 328 | | |
319 | 329 | | |
320 | 330 | | |
| 331 | + | |
| 332 | + | |
321 | 333 | | |
322 | 334 | | |
0 commit comments