This function makes a query every time it is called, which is not good performance wise, especially when it is used for things like http://drupal.org/node/114037

This patch adds a simple static cache to the function, which is cleared from _role_weights_set_weight(), so we don't need to worry about setting/getting weights mid-page load.

CommentFileSizeAuthor
role_weights_get_static.patch1.44 KBowen barton

Comments

pfaocle’s picture

Patch applies fine, working OK. Anyone got any thoughts on performance, or is this a no-brainer?

pfaocle’s picture

Status: Needs review » Fixed

Committed to 5.x-1.x-dev. Thanks again.

pfaocle’s picture

Committed to HEAD and released 5.x-1.2 with this in. Closing issue.

pfaocle’s picture

Status: Fixed » Closed (fixed)