Skip to content

Skip field Initialization when a Motif scope class is created#269

Merged
psteiger merged 1 commit intouber:mainfrom
rysh88:feature_disable_field_init_v3
Sep 10, 2025
Merged

Skip field Initialization when a Motif scope class is created#269
psteiger merged 1 commit intouber:mainfrom
rysh88:feature_disable_field_init_v3

Conversation

@rysh88
Copy link
Collaborator

@rysh88 rysh88 commented Jul 30, 2025

The scope class uses volatile variables to retain the dependencies. Volatile variables are much more expensive than normal variables and write operations are especially more expensive by 5~10 times. The scope class initializes all the fields as soon as it's constructed. The scope class will cause an ANR or performance degradation if it contains many dependencies when it's created.
The suggested change will be assigned a value of null instead of INITIALIZED and making the scope class initialization more lightweight and it also reduces the atomic write/read operations

@rysh88 rysh88 force-pushed the feature_disable_field_init_v3 branch 4 times, most recently from e1605cc to e1fafcc Compare August 7, 2025 03:32
@rysh88 rysh88 force-pushed the feature_disable_field_init_v3 branch from e1fafcc to 52e8aaf Compare August 13, 2025 20:29
@rysh88 rysh88 force-pushed the feature_disable_field_init_v3 branch from 52e8aaf to 49d6e95 Compare August 13, 2025 22:50
@psteiger
Copy link

Reviewed by @TonyTangAndroid and Yohan

@psteiger psteiger merged commit af3011a into uber:main Sep 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants