Page MenuHomePhabricator

Rampant use of $.extend() for default configs is slow when constructing big interfaces with many widgets
Closed, DeclinedPublic


Rampant use of $.extend() is slow when constructing big interfaces with many widgets. We use it for defaults in configuration and to pass configuration to mixins and internal widgets. This can add up for quite a lot of slowness, especially for widgets with many mixins like ButtonWidget.

The worst, and the most common, is $.extend( { ... }, foo ), which copies the foo object into the new object, which takes time. The new object is then usually abandoned after being used once, and has to be soon GC'd.

I'm not sure what we can do here. Maybe more named parameters, maybe something clever with prototypes.

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added a project: OOUI.
matmarex added a subscriber: matmarex.
matmarex triaged this task as Medium priority.Feb 16 2016, 4:48 PM

There isn't really any better solution, or at least not one that wouldn't require some large refactorings and more code everywhere we handle config objects. This shouldn't be a very a big issue.