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.
See #513984: Find bottlenecks in HEAD - meta issue for similar issues and reasoning.
Patch adds a static for user_access(), db_is_active(), drupal_is_front_page() and defined() - all inexpensive in themselves, but when called c. ~500 times on some pages, that's ~2,000 function calls we can avoid. Self time is halved, overall time is reduced to a third.
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedsame as #537110: Optimize theme_username(). real problematic if the active user changes during the request, or the active DB. i've been using the multiple DB support in drupal recently and it is quite nice.
when we are avoiding calling a function, even if the function is fast, we have either over optimized or php has completely let us down.
Comment #2
catchProbably not worth it.