[development] load node globally

Dave Fletcher fletch at splendora.com
Thu Jan 15 21:57:37 UTC 2009


> Since I see so many node loads in block visibility and in modules that do
> $node manipulations and so forth, which would make me think that sometimes
> many node loads might occur on some pages and tens perhaps when you add
> contributed modules on that, I was wondering why not just load $node
> globally on node/<num>/* pages like we do with $user to avoid any extra
> node_loads?

I think it's pretty rare that the same node gets loaded twice. Well,
one example might be a sidebar block with a view of full nodes or
teasers in it. If one of the nodes was the URL target, it would be
loaded once for the page, once for the sidebar.

And how would views take advantage of it? node_load is just smart
enough not to load the node twice? I think there's caching modules
(e.g. the node cache feature of memcached) that do this type of thing.
I'd look into cache modules if you're worried about multiple loads. Oh
and of course, the built-in page cache for anon visitors makes this a
non-issue if the bulk of your traffic is anon.

Cheers,

--fletch


More information about the development mailing list