Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Speed up your forum with a few edits.
LifesGreatestGift's Avatar
LifesGreatestGift
Join Date: Jul 2009
Posts: 885

 

Louisville, KY USA
Show Printable Version Email this Page Subscription
LifesGreatestGift LifesGreatestGift is offline 05-23-2011, 10:00 PM

A lot of search engines are now adding page speed as a determining factor in the way results are ranked and listed. There are a few things you can do to speed up the load time for guests (Bots, unregistered users etc).

GZip Compression

Quote:
The time it takes to transfer an HTTP request and response across the network can be significantly reduced by decisions made by front-end engineers. It's true that the end-user's bandwidth speed, Internet service provider, proximity to peering exchange points, etc. are beyond the control of the development team. But there are other variables that affect response times. Compression reduces response times by reducing the size of the HTTP response.

Source
If your server supports gzip compression you can alter the level of compression in your vBulletin administrator control panel.

AdminCP>Settings>Options>Cookies and HTTP Header Options>

You will see a setting called GZIP Compression Level

Play around with this setting. If used properly, it can dramatically decrease the load time of your site.

Put CSS Stylesheets at the top

If you are using any custom CSS stylesheets, make sure they are at the top of the page when it is rendered. If you have stylesheets loaded after the <head> then you should move them to the top by placing them at the bottom of template headinclude.

Also try avoiding inline CSS.

Example:
Code:
<div style="margin:0 20px;border:1px solid #000000;">
content
</div>
Instead, create a class and then put the attributes for the class in additional.css template.

Example:
Code:
***** ADDITIONAL.CSS TEMPLATE *****
.newdiv {
    margin:0 20px;
    border:1px solid #000000;
}
***** END ADDITIONAL.CSS TEMPLATE *****

**** YOUR DIV THAT WAS USING INLINE CSS ****
<div class="newdiv">
content
</div>
It is relatively easy to find all instances of inline CSS.

Go to AdminCP>Styles & Templates>Search in Templates>
select your style you want to edit, or leave it default to search all templates.

then type in the search box style="

it will then show you all templates that have that in it, you can then search those templates, find the inline CSS, assign a class, and put the class attributes in additional.css

Another tip is to avoid CSS Expressions. Most of the time you can get the look you want without using expressions.

Example of css expressions:
Code:
background-color: expression( (new Date()).getHours()%2 ? "#B8D4FF" : "#F08A00" );
Put Scripts at the bottom

This is also something that will help speed up the load time. Not every script needs to be loaded in the header. Move as many scripts as you can to the footer template.

Quote:
The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostnames.

Source
Make JavaScript and CSS External

This goes along with what I was saying before. Don't use inline CSS and Javascript. Create external css and js files and include the content in them and then add them to your style appropriately.

Example inline css and javascript
Code:
<style type="text/css">
  .body {
    background-color:#FFFFFF;
}
</style>

<script type="text/javascript">
$(document).ready(function(){

    $("a.switch_thumb").toggle(function(){
        $(this).addClass("swap");
        $("ul.display").fadeOut("fast", function() {
            $(this).fadeIn("fast").addClass("thumb_view");
        });
    }, function () {
        $(this).removeClass("swap");
        $("ul.display").fadeOut("fast", function() {
            $(this).fadeIn("fast").removeClass("thumb_view");
        });
    });

});
</script>
Instead create an external file and call it in the template.

Example:
Code:
<LINK href="mystyle.css" rel="stylesheet" type="text/css">
<script src="http://www.mysite.com/js/myjs.js" type="text/javascript">
Minify JavaScript and CSS

Quote:
Minification is the practice of removing unnecessary characters from code to reduce its size thereby improving load times. When code is minified all comments are removed, as well as unneeded white space characters (space, newline, and tab). In the case of JavaScript, this improves response time performance because the size of the downloaded file is reduced. Two popular tools for minifying JavaScript code are JSMin and YUI Compressor. The YUI compressor can also minify CSS.

Source
In addition to minifying external scripts and styles, inlined <script> and <style> blocks can and should also be minified. (If you must use them, it is recommended to have your scripts and styles as external files.)

Reduce the number of DOM elements

vBulletin.com forum has 1909 DOM elements. My site has 670.

A DOM element is something like a DIV, HTML, BODY element on a page. You can add classes to all of these using CSS, or interact with them using JS.

The lower your DOM element count is, the faster your site will render.

You can check the amount of DOM elements on your site by using Firefox with the Firebug addon. Enter the following command in the console of the page you want to check.

Code:
document.getElementsByTagName('*').length


There is no set amount of acceptable DOM elements. But you can get an idea of "acceptable" by looking at high-end sites such as yahoo.com (currently around 928 elements) and others.

You can reduce your DOM element count by removing things that are not necessary, and optimizing your code. For example, you can edit the FORUMHOME template to hide the WGO (What's Going On?) box to guests. When google views your site they are viewing it as a "guest" so the less it has to load and read, the faster it will see your site.

There are a lot of addons for Firefox that will help you in seeing and editing the code to your site, as well as optimizing it such as YSlow! and Page Speed.

Here is a helpful page that has additional things you can do to speed up your site load time.

http://developer.yahoo.com/performance/rules.html



----

WindowsCommunityForum.com - Your source for Windows news, discussion & support
Reply With Quote
  #2  
Old 05-24-2011, 12:36 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great article :up:
Reply With Quote
  #3  
Old 06-04-2011, 08:33 PM
RobbieZ RobbieZ is offline
 
Join Date: Jul 2008
Posts: 1,117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent stuff, I really dont want to shock you with what my read-out was!

Can you explain a little about storing css as files and if this helps at all.

And also external image calls.

Thanks
Reply With Quote
Благодарность от:
nokturno
  #4  
Old 06-23-2011, 10:17 PM
8thos's Avatar
8thos 8thos is offline
 
Join Date: Aug 2010
Location: Pensacola, FL
Posts: 772
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow the 'Make JavaScript and CSS External' part will come in handy for Google Adsense Channels.

--------------- Added [DATE]1308871232[/DATE] at [TIME]1308871232[/TIME] ---------------

'Create external css and js files and include the content in them and then add them to your style appropriately.'

Where can I find out how to do this? I have some Google Channel ads I want to add throughout my site instead of doing them 'inline'
Reply With Quote
  #5  
Old 07-25-2011, 06:11 AM
8thos's Avatar
8thos 8thos is offline
 
Join Date: Aug 2010
Location: Pensacola, FL
Posts: 772
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I love Firebug.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:03 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04016 seconds
  • Memory Usage 2,253KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (1)post_thanks_box_bit
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete