-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[composable-controller] perf: Optimize expensive reduce operations, fix metadata instantiation #4968
base: main
Are you sure you want to change the base?
[composable-controller] perf: Optimize expensive reduce operations, fix metadata instantiation #4968
Conversation
…eating new tmp object every iteration
…non-V2 controllers
…leController state and metadata fields
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
…messenger events allowlists
…ller name object keys
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Motivation
Expensive operations during
ComposableController
instantiation contribute to downstream performance issues in our client apps' initialization times. Optimizing these operations may be especially impactful sinceComposableController
takes large inputs consisting of all of the controllers used by a given client.Explanation
reduce
operations that create temporary objects on each iteration and replace with implementations that re-use their output objects.ComposableController
to accept an object instead of an array. Now that the mobile Engine creates a controllers object, this saves us an extra operation for converting the object into an array.controllers
input. This is now resolved by using a type object.References
ComposableController
API updates that fix broken functionality metamask-mobile#10441Changelog
@metamask/composable-controller
Changed
ComposableController
constructor optioncontrollers
and generic type argumentChildControllers
are re-defined from an array of controller instances to an object that maps controller names to controller instances.ComposableController
'state' field and 'metadata' objects exclude child controllers that do not extend fromBaseController
orBaseControllerV1
.Fixed
ComposableController
'metadata' field object now correctly populatesBaseControllerV1
controller properties with a metadata object that maps state property names toStateMetadataProperty
type objects.BaseControllerV1
controllers were assigned the object{ persist: true, anonymous: true }
, and their state properties were overwritten.Checklist