This patch reduces the number of SQL queries and PHP calls
which get performed when rendering menus. The patch has
two parts:
* Runtime cache is used to remember a generated link and
is given a cache identifier which includes a hash of all
parameters which may affect the link.
* Runtime cache is used to remember the decision if a page
is a submenu.
The item rendering function is called every time the same page
is rendered in any menu in the same request, and the decision
function to check if page is a sub-menu is called at least three
times with the same UID when generating a menu. Both of these
implements together reduce the necessary re-calling of methods
which generate the same output given the same arguments.