-
Notifications
You must be signed in to change notification settings - Fork 31
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
PLAT-109381: Reduce the ImageItem render time #2790
base: develop
Are you sure you want to change the base?
Conversation
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Codecov Report
@@ Coverage Diff @@
## develop #2790 +/- ##
===========================================
+ Coverage 44.61% 44.80% +0.18%
===========================================
Files 163 164 +1
Lines 8158 8187 +29
Branches 1991 1994 +3
===========================================
+ Hits 3640 3668 +28
- Misses 3391 3392 +1
Partials 1127 1127
Continue to review full report at Codecov.
|
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
This reverts commit e3b81ca.
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better shape! Thank you for your efforts.
LGTM!
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not completely clear to me that each of these changes is required to get the performance necessary. In fact, there may be performance and memory regressions from this. Certainly this is much more complicated and it may not be a general solution that could be applied to different components. I'm also not certain that many of the issues might not be resolved by making portions of the components Pure
or by taking other approaches other than using context.
There's not a clear breakdown by how much improvement each piece of this gives to the overall performance. Because of the complexity, I don't think we can move forward with this solution right now.
If we really need to go further, then it seems like we might want to just directly mutate the DOM in these special instances. At least, we'd know the trade-offs we're making in terms of performance for this (and other) components.
}, | ||
|
||
render: ({children, css, imageComponent, orientation, placeholder, src, ...rest}) => { | ||
render: ({className, memoizedChildrenCell, memoizedImageCell, orientation, ...rest}) => { | ||
delete rest.css; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to delete css
, I believe it's non-enumerable.
const omitted = omit(filter, props) || {}; | ||
|
||
return ( | ||
<MemoPropsContext.Provider value={picked}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will force the component to update every time it receives props, even if the values are exactly the same, because the object has changed and context will force the update. Some form of memoization should be done if this truly is the desired solution.
|
Checklist
Issue Resolved / Feature Added
One of the major cause for the list scroll performance is the long JS execution time of the ImageItem. So we need to reduce the ImageItem render time.
Resolution
children
for caption,label
for subcaption,imageIconComponent
,imageIconSrc
, andsrc
not as props but thought a context so that we don't have to render several components again.Update the caption, subcaption, and data-index DOM elements directly instead of rendering components.Additional Considerations
Links
PLAT-109381
Related PR: enactjs/sandstone#461
Previous Branch: https://github.com/enactjs/enact/tree/PLAT-109381-useMemo2
Comments
Enact-DCO-1.0-Signed-off-by: YB Sung ([email protected])