What does the performance difference look like? I am careful to squeeze every bit that I can out of Drupal installations and do all of my own custom theming so it's important to me that my decisions are secure in the long term. In other words, I'd like to use panels more and more but the code it outputs is so bloated and I'm not able to style them as elegantly as Drupal's theme and block systems, so will there be minor performance issues as a result?


merlinofchaos’s picture

Status:Active» Fixed

The code you get out of Panels has a lot to do with the code you put into Panels.

The biggest cause of 'bloat' is the use of the flexible layout generator. If you're concerned with HTML bloat, then don't use the flexible layout generator. Instead, create your own layout plugins within your theme. (For an example of themes that do this, see zen). Then the layout code will be much less bloated. If you have specific concerns about bloat I will be happy to address them, but I don't have a good way to discuss generic applications of the term.

If you think the markup on panes is too heavy, you can use panel-pane.tpl.php much the same way you use block.tpl.php -- it's slightly more powerful so it has a few more options, but it's very, very similar to block.tpl.php.

As far as adding performance issues, Panels Everywhere adds very little, particularly if you export as many pages as you can into code and use something like APC (which is something you really want to try to use anyway, if you can). Plus, Panels has far superior discrete caching options to core that with a little bit of effort in understanding what your heaviest pieces of content are and why, you can get far superior performance with Panels than you can with blocks.

This is particularly true when you actually need the power that PE offers -- i.e, if you have vastly different layouts, because core renders every block whether or not it actually appears in your layout. It's easy to invisibly lose site performance if your block/region structure is complicated.

As always, it's very possible to use Panels and create very slow pages, but not paying attention to the individual pieces of content you put on a page. If you put 5 views in a Panel, and those views run slow queries, then the aggregation of all that content will seem very slow. These days, however, the caching mechanisms of both Views and Panels are quite good and you can get around these slowdowns with a well thought out caching strategy.

merlinofchaos’s picture

I'm not able to style them as elegantly as Drupal's theme and block systems

I don't understand this statement. Maybe it's simply that with Drupal's block system, your themes come with block.tpl.php and it's very clear what you need to do to theme them, whereas with Panels you have to hunt around a bit to find what you need?

neclimdul’s picture

Merlin kinda hinted at it but since the panels system has a pluggable cache, it is much more customizable than block caching. Also, since it operates at different levels, pane and region, there are ways you can tune caching in ways that aren't available to core. In short, caching can lead to very big performance gains in panels versus core blocks.

charlie-s’s picture

Yea, you pretty much nailed it. Thanks for the detailed response. I do have a few sites that use complicated block systems (parameters on whether or not to appear on a given page or term, regions that come and go depending on the content type, etc) and I didn't think about all of the blocks being queried as if they were being used in a page or not; this must have an effect on the performance.

Re the question about theming "elegantly", for example, if I'm converting a Photoshop layout into HTML/CSS that's going to be used in Drupal, I can generally do:

#right-sidebar .block .title {font-size:30px;}
#right-sidebar .block {border:1px solid #000;}

as opposed to doing something with the panels layout generator where I need to use Firebug after-the-fact to see what the elements end up being called. It's not the end of the world or anything, but a simple thing like you pointed out above.

It looks like using panels.tpl.php may be the way to go for more complicated situations.

merlinofchaos’s picture

I've been making adjustments to the flexible layout system that will let you define the region, column and row classes more specifically in order to do that CSS.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.