Not having it set breaks an optimization in menu_link_save() to avoid updating - this patch saved over 2,000 queries for me during menu_rebuild().



catch’s picture

Status: Active » Needs review
414 bytes
PASSED: [[SimpleTest]]: [MySQL] 2,223 pass(es). View

And the patch.

pbuyle’s picture

Status: Needs review » Reviewed & tested by the community

I investigated a performance issue on a site with 1,257 menu links. Turns out the site does 257 update queries on each cache rebuild.

Tracing the issue revealed that the array_intersect_key($item, $existing_item) != $existing_item comparison in menu_link_save() always fail because of $item['i18n_tsid']. Apllying the patch seems to fix the issues.

sylus’s picture

Issue tags: +Performance

Wish I knew about this little gem of a patch earlier! Adding a tag so can increase its visibility.

joseph.olstad’s picture

RTBC+1 , get it in ASAP

joseph.olstad’s picture

Priority: Major » Critical

bumping the priority on this up to critical, as this improvement is amazing

menu_rebuild used to take a very long time, now it happens in a flash.

And this speeds up cache clear because menu_rebuild happens on cache clear.

  • joseph.olstad committed 307b54d on 7.x-1.x authored by catch
    Issue #2338735 by catch: hook_menu_link_alter() should set $item['...
joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

Great work @catch, this improvement alone warrants a release.

candelas’s picture

Thanks @catch :) My site was going nuts with time-outs because menu rebuilds. After updating i18n now it stopped.

joseph.olstad’s picture

ya @candelas , I agree, it was urgent to get a release with this patch. Good to hear your positive feedback.

candelas’s picture

thanks @joseph. I added a new language and more that we translated, more errors. I am very very happy to find this issue and that you made a new release. So I proposed to add it in Commerce Kickstart distribution.

Status: Fixed » Closed (fixed)

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

joseph.olstad’s picture

Status: Closed (fixed) » Needs work

While I very much like the performance improvement, unfortunately this change caused a regression:
#2848806: Menu translation broken in 1.14/15 when editing 3 or more translations

Short term:
- Looks like we're going to have to revert this change and publish a new release until we can find a solution that avoids regressions?

Long term:
- Any assistance is welcome for finding an optimal solution.

joseph.olstad’s picture

I've added potentially a second way to move forward.

Option 1.) revert the above commit using the revert patch in
#2848806: Menu translation broken in 1.14/15 when editing 3 or more translations

Option 2.) use patch 18 in
#2848806: Menu translation broken in 1.14/15 when editing 3 or more translations

joseph.olstad’s picture

Status: Needs work » Needs review