diff options
author | Máté Szabó <mszabo@fandom.com> | 2022-11-07 13:23:37 +0100 |
---|---|---|
committer | Máté Szabó <mszabo@fandom.com> | 2022-11-08 12:13:32 +0100 |
commit | c04cb6f6071073a924144d79601c34d1e7b3e889 (patch) | |
tree | 4b492cf742c853992b16ec0c0b991b4b137ef686 /includes/shell/Result.php | |
parent | 719ce204a081d0989fbbb55cce1554c384dba9a2 (diff) | |
download | mediawikicore-c04cb6f6071073a924144d79601c34d1e7b3e889.tar.gz mediawikicore-c04cb6f6071073a924144d79601c34d1e7b3e889.zip |
Include core PSR-4 classes in the generated classmap
It appears that autoloading classes via MediaWiki's PSR-4 autoloader has
a not insignificant performance penalty, especially when hundreds of
PSR-4 classes like HookRunner's hook interfaces are autoloaded. Using a
classmap autoloader, like we already do for PSR-4 classes from Composer
dependencies, is a potential way to reduce the performance impact
here.[1]
For core classes, this can be done by simply not excluding PSR-4 classes
in AutoloadGenerator, causing it to include appropriate mappings in the
generated autoload.php classmap. I had to exclude one class_alias()
declared in Result.php from the classmap with a NO_AUTOLOAD stanza,
because including it broke AutoLoaderStructureTest's assertion that all
aliases should be defined in the same file as the aliased class.
Assuming this is still an issue, this would already have been a problem
because the test was previously skipping every PSR-4 class. Excluding
this file via NO_AUTOLOAD just restores that status quo.
----
[1] https://phabricator.wikimedia.org/T274041#8358399
Bug: T274041
Change-Id: I0aa62c944d874bf7a9f3a240e72e58fe6a887b28
Diffstat (limited to 'includes/shell/Result.php')
-rw-r--r-- | includes/shell/Result.php | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/includes/shell/Result.php b/includes/shell/Result.php index ecf91604518b..e373d6abee9f 100644 --- a/includes/shell/Result.php +++ b/includes/shell/Result.php @@ -20,4 +20,5 @@ use Shellbox\Command\UnboxedResult; +// NO_AUTOLOAD -- breaks AutoLoaderStructureTest if included in classmap class_alias( UnboxedResult::class, 'MediaWiki\\Shell\\Result', true ); |