Repository navigation
Do not key WeakHashMap by Integer - #60223
Conversation
Visual regressionNo visual differences at ios: no capture |
| AndroidProgressBarManagerInterface<ProgressBarContainerView> { | ||
| @Suppress("IDENTITY_SENSITIVE_OPERATIONS_WITH_VALUE_TYPE") | ||
| private val measuredStyles = WeakHashMap<Int, Pair<Int, Int>>() | ||
| private val measuredStyles = ConcurrentHashMap<Int, Pair<Int, Int>>() |
There was a problem hiding this comment.
Maybe let's just use a SparseArray, and synchronize on it?
There was a problem hiding this comment.
Makes sense, changed to SparseArray + synchronized.
After JEP-401 that will throw IdentityException. Also, int-s outside of [-128;128) are not cached and boxing creates new instances, meaning that GC is free to reclaim them immediately. getStyleFromString only returns 7 different values and the map stores pair of int-s: using LruCache-s is overkill and SparseArray is fine. react#60220
02f559e to
a489e3c
Compare
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D133975563. |
christophpurrer
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
Thank you, @javache and @christophpurrer ! |
|
This pull request was successfully merged by @Yqwed in 375d0a9 When will my fix make it into a release? | How to file a pick request? |
|
I've created cherry-pick requests into 0.87-0.89 branches. |
After JEP-401 that will throw IdentityException. Also, int-s outside of [-128;128) are not cached and boxing creates new instances, meaning that GC is free to reclaim them immediately. getStyleFromString only returns 7 different values and the map stores pair of int-s: using LruCache-s is overkill and SparseArray is fine. #60220 <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. --> ## Summary: Do not key WeakHashMap by Integer as preparation for JEP-401 <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> ## Changelog: Do not key WeakHashMap by Integer as preparation for JEP-401. Pick one each for the category and type tags: [ANDROID][FIXED] - Do not key WeakHashMap by Integer For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> ## Test Plan: <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. --> Differential Revision: D133975563 Pull Request resolved: #60223 (cherry picked from commit 375d0a9)
|
This pull request was successfully merged by @Yqwed in 7517aa3 When will my fix make it into a release? | How to file a pick request? |
After JEP-401 that will throw IdentityException. Also, int-s outside of [-128;128) are not cached and boxing creates new instances, meaning that GC is free to reclaim them immediately.
getStyleFromString only returns 7 different values and the map stores pair of int-s: using LruCache-s is overkill and SparseArray is fine.
#60220
Summary:
Do not key WeakHashMap by Integer as preparation for JEP-401
Changelog:
Do not key WeakHashMap by Integer as preparation for JEP-401.
Pick one each for the category and type tags:
[ANDROID][FIXED] -
Do not key WeakHashMap by Integer
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
Test Plan: