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().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

catch’s picture

Status: Active » Needs review
FileSize
414 bytes

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
Stevel’s picture

In favour of option 1 for the time being, since this also breaks entity translation. See #2836238: Entity Translation Menu (entity_translation_i18n_menu) compatibility check against the i18n_menu (7.x-1.x-1.14).

Stevel’s picture

FileSize
414 bytes

Adding the reverse patch

joseph.olstad’s picture

@Stevel, there's already an open issue for this, with a patch.
#2848806: Menu translation broken in 1.14/15 when editing 3 or more translations

joseph.olstad’s picture

I was waiting for some reviews, but no one reviewed it, so the revert patch has been sitting there for a while.

joseph.olstad’s picture

Status: Needs review » Fixed

Reverted commit 307b54dcdb from oct22, 2016

Status: Fixed » Closed (fixed)

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