Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
BBC RussianHomePhabricator
Log In
Maniphest T105162

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 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 subscribed.

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 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