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.
Hi! The current version of this module makes a *lot* of database queries -- potentially several for every menu item you have on every page load. Although these are small queries, they add up in time.
I've attached a patch that should only make the queries once per each page load using a static variable for caching. At least at my site, this has made it slightly faster.
HTH,
Ricky
Comment | File | Size | Author |
---|---|---|---|
menu_per_role_static_vars_patch.txt | 2.28 KB | pukku |
Comments
Comment #1
AlexisWilke CreditAttribution: AlexisWilke commentedGood point. 8-)
Thank you for the patch!
I actually went ahead and optimized even more since we read the same table twice with the hide from X and show to Y...
So, I cache everything in a single function where I added a parameter to know whether I want the rids or hrids.
It is applied to the 1.x-dev version.
Thank you.
Alexis