While doing some basic token performance optimizations I noted that menu_tokens() loads node menu link data regardless whether the tokens are used.

Attached patch fixes it for me, what saved ~4ms on an average page request making use of tokens and passing a node.

#3 1362502-speedup-node-menu-tokens.patch2.79 KBDave Reid
PASSED: [[SimpleTest]]: [MySQL] 307 pass(es). View
#2 token_node_menu.patch2.27 KBfago
PASSED: [[SimpleTest]]: [MySQL] 314 pass(es). View
token_node_menu.patch2.28 KBfago
FAILED: [[SimpleTest]]: [MySQL] 299 pass(es), 1 fail(s), and 1 exception(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Status: Needs review » Needs work

The last submitted patch, token_node_menu.patch, failed testing.

fago’s picture

Status: Needs work » Needs review
2.27 KB
PASSED: [[SimpleTest]]: [MySQL] 314 pass(es). View

Uhm, it's faster but breaks the token :D Next try.

Dave Reid’s picture

2.79 KB
PASSED: [[SimpleTest]]: [MySQL] 307 pass(es). View

Revised patch that puts this logic in a cached function which is re-usable.

Dave Reid’s picture

Status: Needs review » Fixed

Committed #3 to Git! Thanks fago for helping speed this up!

Status: Fixed » Closed (fixed)

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