vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Code Optimisation - Anyone got anything that can optimise your vB files? (https://vborg.vbsupport.ru/showthread.php?t=45293)

Chris M 11-01-2002 08:57 PM

Code Optimisation - Anyone got anything that can optimise your vB files?
 
Im kinda worried about how many queries my index.php file, and showthread.php file seem to be spilling out...

Has anyone got any code modifications that can reduce the Query count, and optimised the PHP code used?

Satan

DrkFusion 11-01-2002 09:35 PM

InvisionBoard has the queries lower than 10, I don't know what makes vb queries go so high, must be all the extra functions, and juciy features.

Go ask invboard what they do ;)
"Hi, My name is Chris, I am from vBulletin.org, can you tell me how you have your queries so low? so I may use it for my vB board?"
:p

Tigga 11-01-2002 10:05 PM

How many querie's do those pages have?

NTLDR 11-01-2002 10:06 PM

I'd rather have the features than Invision Board :p

N9ne 11-01-2002 11:21 PM

If you remove the queries for total posts, total threads, members, newest member, birthdays, avatars for welcome panel, WOL, that will lose you about hmm, 8 queries on forumhome...

forumdisplay, probably the wol there, and i dunno what else.

showthread, just get rid of everything apart from usernames in the postbit! So you can still see who's posting, and what they're saying!


hehe :D

Erwin 11-02-2002 12:21 AM

Tips:

1) If you've removed the moderator column, remove the whole chunk of code that is used to look up moderators - saves you 1 query.

2) Combine the 3 PM queries into 1 - saves you 2.

3) Put all templates into templatesinclude="" section at the top of the file - saves you a few there.

4) Remove all the unecessary info - eg. I removed the newest member username from index - that's 1 query. I also removed total threads (I left only total posts) - that's another query.

All these queries add up. :)

Dean C 11-02-2002 08:23 AM

Can you show me how to do no2 again Erwin :)

Regards

- miSt

Erwin 11-02-2002 08:41 AM

Replace old PM code with this one.

PHP Code:

$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages,
                                SUM(IF(dateline>
$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
                                SUM(IF(messageread=0 AND folderid=0,1,0)) AS unreadpm
                                FROM privatemessage WHERE userid=
$bbuserinfo[userid] $ignoreusers");

  
$newpm['messages']=$allpm['newpm'];
  
$unreadpm['messages']=$allpm['unreadpm']; 


Brad 11-02-2002 08:54 AM

Do remember that in some cases less querys can = more load on the servers side, sometimes its better to have 2 small querys then one huge one.

N9ne 11-02-2002 09:04 AM

AL: That happens when there's one huge query, as it takes time to run it ;) but if you combine three small queries, it isn't too bad ;)

Question: In some files, I have a few lines of templatesused=

ie. I have several occurances, like this:

$templatesused= loads of template names here
$templatesused= loads here too
$templatesused= some here too!

Would it be better to combine these?

Also, when a template is called elsewhere within the code, how can I tell if it's running an extra query?

Also, what was the method to see what queries are run on each page? I know it's something to do with debug mode...


All times are GMT. The time now is 12:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01138 seconds
  • Memory Usage 1,735KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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