[development] The menu - does it have to be different on
each page?
Richard Archer
drupal.org at juggernaut.com.au
Wed Aug 30 02:11:47 UTC 2006
At 12:09 AM +0200 30/8/06, Gerhard Killesreiter wrote:
>In my endeavour to have better caching in Drupal. One of the things we
>already cache is the menu tree for each user. What we cannot cache is
>the rendered version of this tree (the navigation block) because it
>changes on each and every page.
>
>I was wondering if we need this. Couldn't we always render the complete
>menu and only hide the pieces we don't want to show through some CSS/JS?
I've built sites with upwards of 1000 menu items and loading
an entire menu tree on each page view would be slow and costly
in terms of bandwidth. Of course building a menu tree of that
scale isn't something you want to do often, and I wouldn't
consider it viable for a site with anything but anonymous and
admin users.
I've done some hacking and there is a big performance boost
to menu building to be gained by sanitise-on-input rather
than the current system that sanitises all the data in the
menu tree every time it's built.
I got half-way through hacking into the menu system a
caching mechanism so that it stored the user's original
input and also cached a sanitised version, but that
turned out to not really be workable.
I really think there are huge performance benefits to
switching all of Drupal to a sanitise-on-input model, but
I can see the other side of the argument... the usability
of Drupal is much-enhanced by storing verbatim user input.
Like when you write a PHP snippet as content but forget to
turn on "PHP code". If that was sanitised (i.e. stripped)
I'd have to write that code again. With the current model
I just have to turn PHP code on, which is nice.
...R.
More information about the development
mailing list