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

Performance improvements #173

Open
mondaychen opened this issue Jul 28, 2016 · 4 comments
Open

Performance improvements #173

mondaychen opened this issue Jul 28, 2016 · 4 comments

Comments

@mondaychen
Copy link
Contributor

Hi Elemental-UI members,

Do you have a plan to improve the performance of the components?

I'm trying to rebuild my company's UI system based on elemental-ui. However, to be used in a big product, the basic components must have good performance. As far as I could tell, currently elemental-ui components are not optimized by any means.

A simple way to do it is to add a shouldComponentUpdate method by default in all components.

Possibly affected components:

~/dev/elemental $  ag PropTypes.array
src/components/Dropdown.js
20:     items: React.PropTypes.array.isRequired,

src/components/FormSelect.js
17:     options: React.PropTypes.arrayOf(

src/components/RadioGroup.js
13:     options: React.PropTypes.array.isRequired,

src/components/SegmentedControl.js
11:     options: React.PropTypes.array.isRequired,

~/dev/elemental $  ag PropTypes.object
site/src/components/DemoBox.js
17:     style: React.PropTypes.object,

src/components/Col.js
15:     style: React.PropTypes.object,

src/components/Checkbox.js
13:     style: React.PropTypes.object,

src/components/Container.js
12:     style: React.PropTypes.object,

src/components/FileUpload.js
13:     file: React.PropTypes.object, // https://developer.mozilla.org/en/docs/Using_files_from_web_applications

src/components/FormLabel.js
11:     style: React.PropTypes.object,

src/components/Pagination.js
39:     style: React.PropTypes.object,

src/components/Row.js
12:     style: React.PropTypes.object,
@mondaychen
Copy link
Contributor Author

A related issue: #46

The validation process is actually not slow. It's slow because the whole page is re-rendered when the state (value of the input fields) changes.

@jossmac
Copy link
Member

jossmac commented Sep 9, 2017

@mondaychen thanks for your contribution.

Might it be easier to implement PureComponent rather than shouldComponentUpdate?

Any chance we could get a PR for this?

@mondaychen
Copy link
Contributor Author

Of course, PureComponent will be easier. But it was not there yet when I created this issue :)

According to this tweet, it was shipped with v15.3.0. Do you plan to drop support for older version React, or maybe we can use a polyfill for it?

@jossmac
Copy link
Member

jossmac commented Sep 13, 2017

Haha fair enough. Yeah, I think it's time this project was updated -- it'd be a bump to major, we wouldn't force >= 15.x on consumers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants