0

As an example, let's take a node with 5 fields and two blocks between those fields. E. g. you want an article do be displayed like this:

First field

Second field

Block with related nodes

Third field

Fourth field

Block with ads

Fifth field

In D7, such display is quite simple to create with Views - you use contextual filters to output fields and just put two blocks between them.

Another option is to use node.tpl.php and create the same template.

Which of these two (Views with context. filters and tpl.php files) is better performance-wise, especially when it comes to MySql performance?

1

The two are essentially doing the same work and are going to degrade over load very similarly from my experience. If you look at how views works and builds its content, contextual filters is just aiding the discovery by passing in all the data the view needs. This has to be done one way or another. After that, the view builds the same regardless.

However, tpl files are greatly useful for code management. If you are really worried about performance, then you need to look into memcached and/or Varnish - both are open source and can be implemented easily on most *nix servers.

  • Yes, I am using Varnish already (plus APC and other caching methods). Since I have to use custom templates on almost all of the content types, I was wondering if one of these two methods is better than the other in terms of speed. Thank you for your thoughts. – take2 Jul 27 '14 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.