Page MenuHomePhabricator

Don't store empty objects/arrays in moduleRegistry for e.g. templates
Closed, ResolvedPublic

Description

[..] They're created at run time because those fields are of type Object and they must have a value, so they default to empty object. [..] Inspect mw.loader.moduleRegistry to see many empty arrays for dependencies, for example.

The memory footprint of these objects should be evaluated. Or we can just remove them. I believe in most cases we can safely remove these as they are part of a private structure.

Due to 'templates' having a public getter, we can't remove that one without updating the getter function to provide a fallback. Right now callers are allowed to unconditionally try accessing template keys on the returned object. We shouldn't start returning null there.

Event Timeline

Krinkle created this task.Jul 8 2015, 2:38 PM
Krinkle raised the priority of this task from to Low.
Krinkle updated the task description. (Show Details)
Krinkle moved this task to Inbox on the MediaWiki-ResourceLoader board.
Krinkle added a subscriber: Krinkle.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 8 2015, 2:38 PM

Change 234696 had a related patch set uploaded (by Krinkle):
resourceloader: Don't create empty objects for every module

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

Krinkle claimed this task.Aug 28 2015, 11:17 PM
Krinkle set Security to None.
Krinkle added subscribers: Spage, ori.

Change 234696 merged by jenkins-bot:
resourceloader: Don't create empty objects for every module

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

Krinkle closed this task as Resolved.Sep 14 2015, 1:40 AM