Drupal Performance Tip – replace views blocks with vanilla blocks


Liran is 31 years old and married to his beloved soul-mate Tal. As an avid supporter of the open source community, he plays the role of leading developer for some projects and contributing code to many others. Some of his geek activities include programming, playing his guitar and even running The Hacker’s Choice BBS back in the pre-Internet days of ’95. Liran is passionate about creating software products, combining his technical skills with an exquisite entrepreneurial spirit and business orientation to build successful ventures. Liran currently works at HP Software, leading the development team on a Drupal based collaboration platform in HP's Live Network R&D group. At HPLN, Liran plays a key role in system architecture design, shaping the technology strategy from planning and development to deployment and maintenance in HP's IaaS cloud. Acting as the technological focal point, he loves mentoring team mates, drive for better code methodology and seek out innovative solutions to support business strategies.

You may also like...

6 Responses

  1. Phil says:

    So did you rewrite the views query using entityfieldquery? Do you find EFQ much faster than views in all cases? What about caching strategies? How did you test your performance?

  2. Ryan says:

    Pretty sure it’s time for an iddqd module… instant access to the site as user 1?

  3. Paulius says:

    Can you expand on code level, how you are implementing views blocks in standard block API? Referencing to example works too.

    Performance is critical for Drupal, and your blog posts about best practices are great way to keep it performant as every milisecond counts. Thanks.

  4. Joel says:

    Something doesnt add up. I’m guessing your custom block implementation used caching while your views block implementation was set to no-cache (the default).

  5. Joe says:

    We only have Drupal 7 sites now. Is this performance tip relevant to D7 too, is the performance gain as sweet, and does it need to be tweeked for D7? Thanks!

  6. lirantal says:

    @Joe – yeah it applies to Drupal 7 as well, because this is an approach that basically says – if something is easy enough to just query quickly upon, then do just that with your own custom block, instead of creating a view for it which will probably end up being more expensive to execute (maybe if you use caching this can be lowered but not always the case).

    @Joel – not all block implementations can be cached due to our modified ACLing system in Drupal.

    @Paulius – The block API is simply, I’m just doing a straight-forward query on the database and getting the results back. Thing is that it is much more faster to do it than to have the Views system do it (apparently).

Leave a Reply to lirantal Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>