Page MenuHomePhabricator

mw.widgets.DateInputWidget takes comparably long time to construct, investigate why
Closed, ResolvedPublic

Description

mw.widgets.DateInputWidget takes comparably long time to construct, investigate why.

Possible culprits:

  • We use tons of OOjs UI ButtonWidgets in the CalendarWidget, see T126784.
  • Moment.js functions, look into moment constructor and moment#isSame.

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added a project: MediaWiki-General.
matmarex added a subscriber: matmarex.

Change 271911 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.DateInputWidget: Don't construct moment() objects when not needed

https://gerrit.wikimedia.org/r/271911

Change 271912 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.DateInputWidget, CalendarWidget: Lazy-initialize calendar when first shown

https://gerrit.wikimedia.org/r/271912

Change 271913 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.CalendarWidget: Lazy-initialize calendar buttons too

https://gerrit.wikimedia.org/r/271913

Turns out that the interface of CalendarWidget is just expensive to construct. Not just the ButtonWidgets (about 5 ms per CalendarWidget), but the whole calendar (about 15 ms per CalendarWidget). Interesting.

Change 271911 merged by jenkins-bot:
mw.widgets.DateInputWidget: Don't construct moment() objects when not needed

https://gerrit.wikimedia.org/r/271911

Change 271912 merged by jenkins-bot:
mw.widgets.DateInputWidget, CalendarWidget: Lazy-initialize calendar when first shown

https://gerrit.wikimedia.org/r/271912

Change 271913 merged by jenkins-bot:
mw.widgets.CalendarWidget: Lazy-initialize calendar buttons too

https://gerrit.wikimedia.org/r/271913