material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[DatePicker] Very slow when changing between months

Open almoraleslopez opened this issue 10 years ago • 7 comments

Hello.

I have a performance issue with Date Picker in Chrome 47.0.2526.73 - Linux (Ubuntu 14.04) - MUI 0.14.0-rc1

When I open the date picker dialog and try to go ahead or backward between months the transition is very slow. One month change took nearly 2 seconds. When I click on next month 2 or 3 times sequentially the lag is accumulated and the transition takes long to show the month.

Tested in Firefox and it's working fine.

almoraleslopez avatar Dec 07 '15 18:12 almoraleslopez

Hi @almoraleslopez,

Out of curiosity, is the performance of the date picker also slow on the docs site in your Chrome, or is it isolated somewhere in your project?

http://www.material-ui.com/#/components/date-picker

newoga avatar Dec 07 '15 20:12 newoga

Hi @newoga

Date pickers from docs are working properly in chrome.

I have 2 Datepikers in the same component and look like this:

<DatePicker
                            autoOk={true}
                            floatingLabelText={i18n.t('fromLabel')}
                            defaultDate={from}
                            locale={moment.locale()}
                            DateTimeFormat={Intl.DateTimeFormat}
                            formatDate={this.formatDate}
                            wordings={{ok: i18n.t('apps.common.acceptLabel'), cancel: i18n.t('apps.common.cancelLabel')}}
                            onChange={this.onChangeDatePicker.bind(this, 'from')} />

Note: I use i18next lib for multi language support

almoraleslopez avatar Dec 08 '15 12:12 almoraleslopez

Tested in Windows, Linux (Ubuntu desktop) and Mac and same behavior. It's not a OS related problem.

almoraleslopez avatar Dec 18 '15 18:12 almoraleslopez

@almoraleslopez Thanks for the additional details. I haven't had a chance to try to reproduce this. If you could put up a simple project that reproduces this, that'd be a huge help. You could also consider forking this project and add the same i18next dependency and see if you can add it as an example to the documentation site to see if it's reproducible there.

newoga avatar Dec 18 '15 18:12 newoga

Hi @newoga

I've tested it by forking Material UI and works as expected. Then I've tried back in my app and works fine.

I think the problem was in the perfomance of my computer. When I opened the issue I had all the development tools working (gulp/grunt, debugging, etc) and maybe it cause the lag and performance issue.

I'll report any new issue if I find any problem.

almoraleslopez avatar Dec 20 '15 12:12 almoraleslopez

@newoga i think problem AutoPrefix, sample timeline. what do you think? xxx

also reference article https://developers.google.com/web/fundamentals/performance/rendering/

c0b41 avatar Dec 20 '15 12:12 c0b41

@almoraleslopez Thanks for the update. If you run into the issue again (even if it's just in development with all those tools running), let me know. We may be able to learn something about the performance characteristics of that component as a result.

@ayhankuru Thanks for sharing! Can't rule anything out at the moment. Though since @almoraleslopez reported times were a lot longer and he couldn't reproduce it on the docs website, we can't be sure that the proportion of the times that you reported will be representative of his. If you notice worth investigating or see any approached to improving performance in general, feel free to open a new issue to discuss or a PR if it's a simple fix!

newoga avatar Dec 20 '15 17:12 newoga