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.

Files: 
CommentFileSizeAuthor
#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 ]

Comments

Status:Needs review» Needs work

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

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

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

StatusFileSize
new2.79 KB
PASSED: [[SimpleTest]]: [MySQL] 307 pass(es).
[ View ]

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

Status:Needs review» Fixed

Committed #3 to Git! Thanks fago for helping speed this up!
http://drupalcode.org/project/token.git/commit/80c08b7

Status:Fixed» Closed (fixed)

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