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.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1574746-smarter-menu-rebuild.patch | 2.22 KB | bojanz |
Comments
Comment #1
bojanz commentedEasy enough.
Comment #2
rszrama commentedGreat, very nice.
Comment #4
anybodyHas this ever been fixed / commited? Seems like "timed out" but is important for performance? (No commit visible)
Comment #5
rszrama commentedYes, 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.)
Comment #6
anybodyThank you very much and sorry. My mistake.
Comment #7
rszrama commentedNo worries - d.o didn't do any sort of retroactive notifications with the rollout. Would've been a good idea, tho. ^_^