Title says it all. menu_rebuild() rebuilds the menu immediately. variable_set('menu_rebuild_needed', TRUE) schedules the rebuild for the next page load.
This means that even if you call menu rebuilding code 10 times, the variable_set way will ensure it's not rebuilt more than needed (which is once).

This improves install performance, where we frequently had menu rebuilds happening multiple times for no good reason.

CommentFileSizeAuthor
#1 1574746-smarter-menu-rebuild.patch2.22 KBbojanz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

Status: Active » Needs review
FileSize
2.22 KB

Easy enough.

rszrama’s picture

Status: Needs review » Fixed

Great, very nice.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anybody’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs review

Has this ever been fixed / commited? Seems like "timed out" but is important for performance? (No commit visible)

rszrama’s picture

Status: Needs review » Closed (fixed)

Yes, I wouldn't have marked it fixed otherwise. ^_^

(It just predates the time when d.o started tagging related issues with commit links; if you look in the code, you can see it's been committed.)

Anybody’s picture

Thank you very much and sorry. My mistake.

rszrama’s picture

No worries - d.o didn't do any sort of retroactive notifications with the rollout. Would've been a good idea, tho. ^_^