Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Thread view optimizations Details »»
Thread view optimizations
Version: 1.00, by Zzed Zzed is offline
Developer Last Online: Feb 2012 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 07-28-2003 Last Update: Never Installs: 33
 
No support by the author.

This is a little hack that I did to improve the speed at which threads are
loading in my forums. I am experiencing very high server loads due to the
limited hardware on the server and due to the high post counts in my forums.
This hack has tremendously sped up showthread.php.

In order to view an entire thread, showthread.php makes 3 queries into the
post table. I have managed to divert one of these queries to the thread table,
and have managed to combine the remaining 2 queries into a single query.

The thread table is usually 10%-15% of the post table in terms of count, and
it is about 5% of the post table in terms of its physical size. Using the
thread table for one of the queries will definitely improve things.

This hack requires no template or table changes. It is just 3 simple code
changes made to the source code.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 07-30-2003, 06:46 AM
Darkwaltz Darkwaltz is offline
 
Join Date: Jun 2003
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice, easy to install and speeds up my pages a lot

*install*
Reply With Quote
  #13  
Old 07-30-2003, 06:59 AM
MrNase MrNase is offline
 
Join Date: May 2003
Location: Germany
Posts: 670
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

:bunny: wow! loads a lot faster, thx

clicking install....
Reply With Quote
  #14  
Old 07-30-2003, 10:04 AM
pwr_sneak pwr_sneak is offline
 
Join Date: Oct 2001
Location: Germany
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 08:36 AM Dolby said this in Post #10
So far its working nice. Why didnt vBulletin do this? Is there some sort of draw back?
they didn't implement this because it would not work for forums which moderate new posts.
but you could use $forum['moderatenew'] to decide which version you wanted to use.

if ($forum['moderatenew']) {
//use old queries
}
else {
//use faster queries
}
Reply With Quote
  #15  
Old 07-30-2003, 02:19 PM
ed2k_2 ed2k_2 is offline
 
Join Date: Sep 2002
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed without any problem. Threads load more faster!
Thanks Zzed!
Reply With Quote
  #16  
Old 07-30-2003, 03:21 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Same here !
Reply With Quote
  #17  
Old 07-30-2003, 03:37 PM
corsacrazy's Avatar
corsacrazy corsacrazy is offline
 
Join Date: May 2002
Location: london
Posts: 854
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 05:21 PM Mist said this in Post #15
Same here !

where to ? :ermm:
Reply With Quote
  #18  
Old 07-30-2003, 04:19 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My forums are private
Reply With Quote
  #19  
Old 07-30-2003, 07:48 PM
oldgamesnu oldgamesnu is offline
 
Join Date: Jun 2003
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Before: in 0.24841595
After: 0.20439696
Reply With Quote
  #20  
Old 08-03-2003, 04:18 PM
fury's Avatar
fury fury is offline
 
Join Date: Oct 2001
Location: Indiana
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
07-30-03 at 07:04 AM pwr_sneak said this in Post #13
they didn't implement this because it would not work for forums which moderate new posts.
but you could use $forum['moderatenew'] to decide which version you wanted to use.

if ($forum['moderatenew']) {
//use old queries
}
else {
//use faster queries
}

Why not just change this line...

Code:
$postids.= "post.threadid='$threadid'";
to this:

Code:
$postids.= "post.threadid='$threadid' AND post.visible='1'";
It might slow it down a tiny bit more but it works with moderated forums...
Reply With Quote
  #21  
Old 08-03-2003, 04:26 PM
fury's Avatar
fury fury is offline
 
Join Date: Oct 2001
Location: Indiana
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

BTW, this (after you've applied the mod)
Code:
$postscount=$DB_site->query_first("SELECT replycount AS posts FROM thread WHERE threadid='$threadid'");
$postscount[posts]++;
$totalposts=$postscount[posts];
can be replaced, to save yet another query, with this:
Code:
$totalposts = $thread['replycount'] + 1;
since the thread info is already fetched earlier in the file.
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 10:58 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.02646 seconds
  • Memory Usage 2,309KB
  • Queries Executed 27 (?)
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
  • (4)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete