Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The permissions page calls system_rebuild_module_data() to get module names - takes about 3M of memory.
Proposed resolution
Use getName() on the module handler instead.
Remaining tasks
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#10 | 2488610_module_handler.patch | 2.63 KB | catch |
#7 | 2488610_module_handler.patch | 2.62 KB | catch |
#5 | 2488610_module_handler.patch | 2.61 KB | catch |
#2 | Screen Shot 2015-05-14 at 2.42.34 PM.png | 49.73 KB | catch |
#1 | 2488610_module_handler.patch | 2.55 KB | catch |
Comments
Comment #1
catchComment #2
catchRight screenshot this time.
Comment #3
catchComment #4
kim.pepperMinor nitpick:
Needs @param docblock
Comment #5
catchThanks! Added the @param docblock.
Comment #6
BerdirNice find, we didn't see this one when improving getName() because it didn't call system_get_info()...
Testing this with the following in index.php, on an beta8 installation with a fair amount of roles and permissions and 215 non-test-folder .info.yml files (core as 74).
This isn't too exact, since I also had to apply the patch from #2281989: Add a fast and simple way to get module name from the module handler, but it makes a nice difference for me:
Before:
After:
This is with xdebug and xhprof disabled. execution time varies quite a bit, but the memory numbers are stable.
Setting to needs work for the following nitpick:
type hint should be ModuleHandlerInterface (docs are correct).
Comment #7
catchJust that type-hint change.
Comment #8
BerdirLooks good to me :)
Comment #10
catchUse statement also needed updating.
Comment #11
kim.pepperLooks great.
Comment #12
alexpottThis issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 241def3 and pushed to 8.0.x. Thanks!