1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Improving the Speed of XenForo

Discussion in 'Forum Management' started by System0, Aug 26, 2013.

  1. System0

    System0 Active Member

    I am currently optimising all my WordPress websites for a book I am writing on the same subject. I am looking to do the same with my three XenForo forums.

    A quick review shows that there are a number of things that I need to address such as:
    • Specify image dimensions
    • Defer parsing of JavaScript
    • Optimize the order of styles and scripts
    • Minify CSS
    I can do many things myself such as combing images using CSS sprites and reducing calls to external services (Damn Adsense ads!); however I am not sure what is the best way to approach some of the other issues.

    For example, is there a way to modify XenForo so that image dimensions are always defined? Likewise, a way to automatically place all Javascript just before the closing tag?

    Would love to hear from those of you who have optimised your forums and improved your PageSpeed and YSlow scores.

  2. Slavik

    Slavik XenForo Moderator Staff Member

    Levering server side caches will help also.
  3. Parminder Singh Chahal

    Parminder Singh Chahal Active Member

    Xenforo out of box and server side cache works very well. I would be very interested in knowhing how you achieve all the goals you have set. Would be great if I could improve my own forums as well.

    I just did a test for you to show how a default out of the box xenforo home page would load coupled with server side cache : http://www.webpagetest.org/result/130826_55_QMJ/

    This is using DSO as php handler with nginx as proxy to apache and php 5.3 along with APC. I hope this helps.
    Marcus likes this.
  4. Adam Howard

    Adam Howard Well-Known Member

    Fewer add-ons.... Which is a big problem for me, because I love adding little toys.
  5. AndyB

    AndyB Well-Known Member

    I suspect if attachments in posts had dimensions, they would not resize automatically to fit the viewable area of the monitor when the browser window is resized.
    Adam Howard likes this.
  6. System0

    System0 Active Member

    Thanks Slaiv. I've sent an email to my host for advice on this.

    Yeah that is very quick. The repeat viewing was only 0.425 seconds. The goal should be for all of us to get as close as we can to that.

    It is for me too. That is what I am going to address. I have three forums. Two are active and one gets very little traffic. So the one with low traffic will be the one I am going to do my testing with (as well as upgrading to the latest XenForo).

    I just rated the one with low traffic and GTMetrix showed:

    Page load time:
    Total page size: 863KB
    Total number of requests: 57

    I then disabled all add-ons and tested again and got this:

    Page load time: 2.76s
    Total page size: 706KB
    Total number of requests: 25

    It's encouraging to see so the number of requests decrease so much. My busier forums currently have a total of 130 and 78 respectively. So I imagine that I will see a bigger improvement there if I uninstall some add-ons.

    I believe many add-ons can be removed and cannot be considered essential, however the anti-spam add-ons will need to be kept due to the spam problem that all forums seem to have.

    That is something I had not considered. Good point.
    Adam Howard likes this.
  7. System0

    System0 Active Member

    I am still working on optimising my forums. One of the biggest causes of my page load is Javascript not being placed before the closing tag (it is adding close to 300kb). I am unsure how to do this through XenForo. The old plugin XF Optimise did this but it is no longer supported. Is there a manual way of doing this?
  8. Jeremy P

    Jeremy P Well-Known Member

    I've suggested moving the JS numerous times but they don't seem willing to make the change for whatever reason :rolleyes:
  9. System0

    System0 Active Member

    GTMetrix reports that it is the biggest thing slowing down my forums. You would think that would make it a priority.
  10. Deepmartini

    Deepmartini Well-Known Member

    Where do you move the JS?
  11. RoldanLT

    RoldanLT Well-Known Member

    I think on "PAGE_CONTAINER" template.
    Move this line:
    <xen:include template="google_analytics" />
    <xen:include template="page_container_js_head" />
    Above "</body>"
  12. AndyB

    AndyB Well-Known Member

    Hi RoldanLT,

    I tried this but when I try to Reply to a post I get this error message:

  13. sonnb

    sonnb Well-Known Member

    XenForo already has option to minify CSS.

    whynot likes this.
  14. RoldanLT

    RoldanLT Well-Known Member

    So it's not recommended practice, I just tried to answer what's being asked.
  15. System0

    System0 Active Member

    Javascript should be loaded directly before the closing body tag. GTmetrix advises that for my forums, I will save up to 400kb doing this.
  16. sonnb

    sonnb Well-Known Member

    Are you sure about that? There is no bandwidth saving by moving JS to that location. There is only one advantage is to load CSS & HTML first to speed up page rendering.
    zastavra and bortrenamo like this.
  17. System0

    System0 Active Member

    Yes, it reduces the time on the first page rendering. That is what Google and other search engines are using to check the speed of websites. Google have been very open about the fact that search engine rankings use the speed of a website as a factor. Their PageSpeed service advises Javascript to be moved to the bottom.
  18. sonnb

    sonnb Well-Known Member

    Yes, that is what I mean. But there is no bandwidth saving here.
  19. System0

    System0 Active Member

    Bandwidth is not the issue here. It is about:

    1. Loading pages quicker for users.
    2. Getting a faster page speed in order to get better rankings in search engines.
    Resolving this issue could upgrade my YSlow rating from C to A. It is important and needs to be addressed.
  20. sonnb

    sonnb Well-Known Member

    I agree with you. I just want to talk about your words about "saving 400kb". Other than that, completely agree with you.
    zastavra likes this.

Share This Page