Skip to content
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

[DropDownMenu] Preliminary step toward virtualization #3707

Merged
merged 1 commit into from
Mar 18, 2016
Merged

[DropDownMenu] Preliminary step toward virtualization #3707

merged 1 commit into from
Mar 18, 2016

Conversation

oliviertassinari
Copy link
Member

This is a preliminary step toward adding support for react-virtualized and react-list.
We need to stop cloning children and doing heavy computation with them. cc @bvaughn.

Hopefully, that's already improving the performance of the rendering method (#2787).
Before : 446 ms to open the Long example
capture d ecran 2016-03-15 a 22 35 22

After : 374 ms to open the Long example
capture d ecran 2016-03-15 a 22 44 03

@bvaughn
Copy link

bvaughn commented Mar 16, 2016

Looks like a nice improvement. :)

I found myself wondering how much more time you could save if you got rid of the other child-cloning that's happening inside of the Menu component. For me it takes your "Long example" time from ~350ms down to ~190ms. That's a pretty nice savings, although it would require some non-trivial changes to Menu and that might rule it out as a possibility. Otherwise it might be worth considering moving towards supporting a child-factory-function instead of pre-declared MenuItem children.

@oliviertassinari
Copy link
Member Author

@callemall/material-ui This is a friendly ping :).

@@ -367,17 +367,17 @@ const Menu = React.createClass({
this._setFocusIndex(focusIndex, false);

if (multiple) {
const index = menuValue.indexOf(itemValue);
const newMenuValue = index === -1 ?
const index2 = menuValue.indexOf(itemValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response 😅

I think itemIndex is more readable.

@alitaheri
Copy link
Member

All good aside from that 😅

@alitaheri alitaheri added PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI and removed PR: Needs Review labels Mar 17, 2016
@oliviertassinari oliviertassinari added PR: Needs Review and removed PR: needs revision The pull request can't be merged. More details is available on the code review or fails in the CI labels Mar 17, 2016
oliviertassinari added a commit that referenced this pull request Mar 18, 2016
[DropDownMenu] Preliminary step toward virtualization
@oliviertassinari oliviertassinari merged commit 0517f8a into mui:master Mar 18, 2016
@oliviertassinari oliviertassinari deleted the dropdownmenu-step-1 branch March 18, 2016 07:43
@oliviertassinari
Copy link
Member Author

@bvaughn Wow, that's a pretty nice time saving. Cloning element, as we can expected, is pretty expensive.

Otherwise it might be worth considering moving towards supporting a child-factory-function instead of pre-declared MenuItem children.

The API of this component used to be something close to a child-factory-function.
I'm gonna keep investigating the integration, I will ping you If I need help :).

@bvaughn
Copy link

bvaughn commented Mar 18, 2016

Congrats on getting the first step merged! I'm looking forward to seeing what's next. :)

@zannager zannager added the component: menu This is the name of the generic UI component, not the React module! label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants