vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   Improve page load time (https://vborg.vbsupport.ru/showthread.php?t=234486)

Jon_Simmonds 01-28-2010 10:00 PM

Improve page load time
 
With google now apperently taking in page load time into account for rankings, and looking at the Labs > Site Performance link on Google Webmaster Tools, it says my forums were slow to load up I have spent the last few days looking at how to speed things up. Now while you can control what googlebot see's via robots.txt, the info uses to generate page load time appears to come from the google toolbar, which means all parts of your site visible to members have the page load time logged

I came across this article on vbulletin.org - https://vborg.vbsupport.ru/showthread.php?t=223251 and just have a few quick tips that can be done to help make things faster.

I have mainly focused on what can be improved in terms of vbulletins templates, rather than tinkering with servers etc, some of these were touched in the article I linked in above but I feel that I have added onto them, all of this I have found from researching the net/google/etc so I don't take any credit for anything!

While doing this, I found it relativly easy to improve on the forumhome & forumdisplay templates, though when it comes to showthread the biggest issue is images in your member's signatures - inactive members could have links to images that 404, others may have multiple images in theirs.

1) If using the Yahoo CDN to host the YUI libraries, then use Yahoo's combine function


In the header include template replace the following
Code:

<script type="text/javascript" src="$stylevar[yuipath]/yahoo-dom-event/yahoo-dom-event.js?v=$vboptions[simpleversion]"></script>
<script type="text/javascript" src="$stylevar[yuipath]/connection/connection-min.js?v=$vboptions[simpleversion]"></script>

with
Code:

<script type="text/javascript" src="http://yui.yahooapis.com/combo?2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js&2.8.0r4/build/connection/connection-min.js"></script>
This only works on the Yahoo CDN for the YUI files, not for Google or from your own server, if you use other YUI libraries then you can use this page to add what libraries you need : http://developer.yahoo.com/yui/artic...-dom-event&MIN

Simple really, 2 http requests or 1 http request, for what is the same data, that will be called on every page. If you use a few mods check if they use any other YUI libaries and consider loading them in this way.

2. Improve the loading of CSS

Using store CSS as a file I then modified the code to make vbulletin treat the CSS via a link rather than import - http://www.vbulletin.com/forum/showt...import-vs-link

Depending on your style, you could consider combining the CSS into one, to save on http requests, but that really depends on how you have your style setup on your forums.

3. Make use of css image sprites
These can really make a difference to page load times, I found a great CSS sprite generator
at http://csssprites.com/ although I prefer to use <img> tags rather than <div>'s that the generator uses, so read this article http://cssglobe.com/post/3028/creati...ul-css-sprites and use the background position info from the genarator & the <img> tags suggested by the article

4. Turn of signatures for in-active members

Consider turning off signatures for members who haven't been active in X days by changing the following code in both postbit & postbit_legacy (well either/or depending on how you run your forums)
Code:

<if condition="$post['signature']">
<!-- sig -->
<div>
__________________<br />
<div class="hidesig">$post[signature]</div>
</div>
<!-- / sig -->
</if>

to
Code:

<if condition="$post['signature']">
<if condition="$post[lastactivity] > TIMENOW - X*86400">
<!-- sig -->
<div>
__________________<br />
<div class="hidesig">$post[signature]</div>
</div>
<!-- / sig -->
</if>
</if>

Changing X to a value in days

[EDIT]
Or for vbulletin 4.x use the following (Thanks to BBR-APBT for the code)
Code:

<vb:if condition="$post['signature']">
<vb:if condition="$post['lastactivity'] > TIMENOW - X*86400">
    <blockquote class="signature restore"><div class="signaturecontainer">{vb:raw post.signature}</div></blockquote>
</vb:if>
</vb:if>

[/EDIT]

Princeton 01-31-2010 04:41 PM

great tips :up:

BBR-APBT 01-31-2010 10:24 PM

Considering this is in the vB4 section the correct if conditionals will be.
Code:

<vb:if condition="$post['signature']">
<vb:if condition="$post['lastactivity'] > TIMENOW - X*86400">
    <blockquote class="signature restore"><div class="signaturecontainer">{vb:raw post.signature}</div></blockquote>
</vb:if>
</vb:if>


Jon_Simmonds 02-02-2010 04:22 PM

I had meant it to be for vb3.x, as I have not yet moved to 4, though the submissions area seams to cover both 3.x & 4.x

I will amend the first post with your code :)

bada_bing 02-03-2010 07:26 PM

I had a question about the conditional signature code as this is a great idea...

looking at your code below
<if condition="$post[lastactivity] > TIMENOW - X*86400">

you mention to change X to days but what do we do with *86400 which is 24 hours?

What would that look like if I wanted signature to not display if not active with 4 weeks ?

thanks

Audax666 02-08-2010 09:58 AM

4 Weeks are 28 days, so it should be 28*86400 in your code. (28 times x 1 day/24 hours)

Or am I wrong or missunderstood something?

lazydesis 02-11-2010 01:08 AM

the store as css does not seem to be working on vb4

when i go into admincp it throws me an error about parsing variables?

Quote:

Fatal error: Only variables can be passed by reference in /home/MYDIR/public_html/includes/adminfunctions_template.php on line 3294
i commented out the code in blue and added the code in red

Code:

                        delete_css_file($styleid, $csscache["$styleid"]);

                        $adblock_is_evil = str_replace('ad', 'be', substr(md5(microtime()), 8, 8));
                        $cssfilename = 'clientscript/vbulletin_css/style-' . $adblock_is_evil . '-' . str_pad($styleid, 5, '0', STR_PAD_LEFT) . '.css';

                        // if we are going to store CSS as files, run replacement variable substitution on the file to be saved
                        if ($vbulletin->options['storecssasfile'])
                        {
                                $css = process_replacement_vars($css, array('styleid' => $styleid, 'replacements' => serialize($replacements)));
                                $css = preg_replace('#(?<=[^a-z0-9-]|^)url\((\'|"|)(.*)\\1\)#iUe', "rewrite_css_file_url('\\2', '\\1')", $css);
                                if (write_css_file($cssfilename, $css))
                                {
//                                        $css = "@import url(\"$cssfilename\");";
                                        $css = "<link rel='stylesheet' type='text/css' href='".$cssfilename." />";
                                }
                        }

                        $fullcsstext = "<style type=\"text/css\" id=\"vbulletin_css\">\r\n" .
                                "/**\r\n* vBulletin " . $vbulletin->options['templateversion'] . " CSS\r\n* Style: '$title'; Style ID: $styleid\r\n*/\r\n" .
                                "$css\r\n</style>\r\n" .
                                "<link rel=\"stylesheet\" type=\"text/css\" href=\"clientscript/vbulletin_important.css?v=" . $vbulletin->options['simpleversion'] . "\" />"
                        ;

doesnt seem to work .. anyone can check this for me please .. thanks

ChopSuey 02-20-2010 10:04 AM

This is a great artile thanks for sharing :)

Kolbi 03-22-2010 06:10 PM

Are there other possitive reports about these improvements?

pant 03-25-2010 03:31 PM

The best improvement I got overall was to disable CMS and Blogs and store the stile as files.


All times are GMT. The time now is 01:42 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.01299 seconds
  • Memory Usage 1,761KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete