You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 200.0.0-beta, because we used the StateObject-for-map pattern, many view properties are created as type property, or gets their default value from a static method. This is not a memory efficient approach as many static properties will stay in the memory longer than desired.
Instead, we can move the static methods into the traditional initialization process, and make the properties instance properties instead of type properties. Most often seen with graphics and graphics overlays.
See "Using Computed Variable" in the contribution guideline for more details.
The text was updated successfully, but these errors were encountered:
I would argue that static methods are sometimes essential to declutter the initializer. Compared to static properties, they shouldn't be a huge problem as the memory footprint can be pretty small, just a pointer to a method vs the static properties object size.
While we are examining all static and class keywords for type methods/properties, most of the time we only need to fix the properties in question.
Criteria
More than 256 bytes
can be converted to computed property or static factory method
yo1995
changed the title
Get rid of unneeded static methods/properties
Get rid of unneeded static properties
May 25, 2023
In 200.0.0-beta, because we used the StateObject-for-map pattern, many view properties are created as type property, or gets their default value from a static method. This is not a memory efficient approach as many static properties will stay in the memory longer than desired.
Instead, we can move the static methods into the traditional initialization process, and make the properties instance properties instead of type properties. Most often seen with graphics and graphics overlays.
See "Using Computed Variable" in the contribution guideline for more details.
The text was updated successfully, but these errors were encountered: