vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Optimize forumhome, the filburt1 Way (https://vborg.vbsupport.ru/showthread.php?t=53455)

filburt1 05-26-2003 10:00 PM

Optimize forumhome, the filburt1 Way
 
This hack greatly reduces the number of queries on forumhome. On my test board, before:
Code:

Page generated in 1.81393003464 seconds with 30 queries,
spending 1.17402160168 doing MySQL queries and 0.639908432961 doing PHP things.

After:
Code:

Page generated in 1.37496697903 seconds with 20 queries,
spending 1.00117218494 doing MySQL queries and 0.373794794083 doing PHP things.

The very, very clever hacker can combine elements of this hack and Xenon's to reduce forumhome queries even more; specifically, his optimizations for a moderator cache and Who's Online.

There's also an added benefit: since the number of rows in all tables are cached and not just users, posts, and threads, you can use $counts[tablename] anywhere in forumhome and have the number of rows in tablename show up (for example: Mail Messages: $counts[mailmessage]).

Note that because some PM processing is now given to PHP instead of MySQL, the page load time might increase. It will depend on how many PMs the current user has, among other things. However, the PM handling eliminates two queries.

corsacrazy 05-27-2003 04:38 PM

hey if i sent u my index.php wood u b able 2 gib us a hand optimising ? my index.php is hacked up :(

i hav 26 queries on forum home

Boofo 05-27-2003 04:39 PM

Interesting idea. I don't have Xenon's hack installed, but I am using Tigga's Forumhome Stats cache. Care to add the moderator's cache and online users cache? ;)

assassingod 05-27-2003 04:39 PM

Nice filburt:)

[high]* assassingod clicks install[/high]

filburt1 05-27-2003 04:39 PM

Sorry but you're not allowed to send people full vB files (not that I don't get them every now and again :p).

Tigga 05-27-2003 04:55 PM

Odd.. I tried installing this and it actually increased the page load time. I already have Xenon's hack and my Stats Cache installed, so I wouldn't really see the benefits for parts of this. It seems to be coming mostly from the PHP code that gets the private message info...

Before
Query: SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=1 AND messageread=0 AND folderid=0
Time before: 0.19265496730804
Time after: 0.22409498691559

table type possible_keys key key_len ref rows Extra
privatemessage ref userid userid 4 const 1947 Using where

--------------------------------------------------------------------------------

Query: SELECT * FROM statscache
Time before: 0.2369509935379
Time after: 0.23781204223633

After
Query:
SELECT privatemessageid, messageread, dateline, folderid
FROM privatemessage
WHERE userid = 1
Time before: 0.28443694114685
Time after: 0.32564997673035

table type possible_keys key key_len ref rows Extra
privatemessage ref userid userid 4 const 1947 Using where

--------------------------------------------------------------------------------

Query: SELECT * FROM statscache
Time before: 0.50849199295044
Time after: 0.54340195655823

Xenon 05-27-2003 05:07 PM

nice hack filburt, i see some really nice things in it.
but the PM query, i think it would take longer if a user has more PM's stored, so i think here your way will increase the load of the system more than it saves...

edit: also the newest member part ist slower than the original way i think, here would help a cache (like on vb.org ;)) more i think

filburt1 05-27-2003 05:13 PM

True, it's a tradeoff: one query instead of three for PMs, but the processing is handed over to PHP instead.

I'm morally opposed to caches, they're a PITA to update :p

Xenon 05-27-2003 05:18 PM

i like caches if i can use them without to much problems ;)

yeah one query instead of three is better this way.
but i know from my first version where i had one query for pming it was much slower than the old three, when a user has had a lot pm's that's why i used my compromis of two queries ;)

nevertheless, i'll see if i can use some of your ideas here ;)

Tigga 05-27-2003 05:19 PM

Quote:

Today at 02:07 PM Xenon said this in Post #7
but the PM query, i think it would take longer if a user has more PM's stored, so i think here your way will increase the load of the system more than it saves...
Good point. I have over 2,300 PM's saved right now. When I logged in with a test account though it did seem to speed the generation time up by just a little. Because of the other hacks I have installed though it only saves one query and the page generation time doesn't seem to be enough to warrant installing it (plus I don't want to slow the generation time down for myself :p). Either way though it's still a nice idea filburt. :)

Dean C 05-27-2003 05:23 PM

The cache-meisters :)

I'd love to see showthread.php's queries reduced :)

- miSt

Boofo 05-27-2003 05:25 PM

Tigga and xenon, which parts would be ok to use then? ;)

Xenon 05-27-2003 05:28 PM

@Boofo: you can use everything, the pm thing i'd suggest to use mine, but the other stats are good by filburt.
it depends also a bit on your board, what you have optimized already ;)

Boofo 05-27-2003 05:36 PM

Right now, I have Tigga's Forumhome Statscache installed. I had your hack installed but had to remove it when I couldn't get the browsers hack working with it. ;)

Xenon 05-27-2003 05:39 PM

boofo that was version 1 of my hack, version 2 has no problems with any hacks :)

you should use some parts of mine and others by filburts to get an optimum :)

Boofo 05-27-2003 05:43 PM

Your version 2 works with the countbrowsers on forumhome? I didn't know that. I will have to use it now. Will it work ok with Tigga's hack or do I need to uninstall that one first and then re-install it after I install yours?

Chris M 05-27-2003 05:52 PM

Nice filburt!:)

Got my forumhome (on a new site) down from 22 to 16:)

Satan

Alien 05-27-2003 07:17 PM

I have Xenon's excellent hack installed. No other forumhome optimizations are installed.

What parts of this specifically should I install that will benefit me? I got myself down to 19 queries and would love to move it down further! :D I'd also like to skip out on the PM optimization, I'd just like to use whatever else that isn't a part of Xenon's hack.

-Jason

nuno 05-27-2003 09:44 PM

Nice hack.
Thanks filburt.

xs1 05-28-2003 03:20 PM

thx installed the hacksucessfully

from 26 to 22

sonic3d 05-28-2003 03:26 PM

nice. from 22 to 17.

l8er
sonic

Erwin 05-28-2003 09:39 PM

17? Very sweet. I already have 22 on mine with no optimization except my own, but I don't use caching. Just modifying code, and removing things I don't need, like the moderator query (did you know that you can take that away if you don't have a moderator column?).

Boofo 05-28-2003 09:43 PM

But if you have the Miderators listed like they do here on vb.org (Moderated By: ), you still need it right?

Xenon 05-28-2003 09:45 PM

for now, yes, but i'll remove it soon ;)

that's where i like my hack ^^

Boofo 05-28-2003 10:02 PM

But you will still have the "Moderated By:", right?

limey 05-28-2003 10:33 PM

I went from 20 to 13, but the members, posts, and birthdays act wacky so I'm putting it back :(

limey 05-28-2003 10:33 PM

I went from 20 to 13, but the members, posts, and birthdays act wacky so I'm putting it back :(

base 05-28-2003 10:34 PM

Quote:

Yesterday at 11:39 PM Erwin said this in Post #23
17? Very sweet. I already have 22 on mine with no optimization except my own, but I don't use caching. Just modifying code, and removing things I don't need, like the moderator query (did you know that you can take that away if you don't have a moderator column?).

how would i accomplish that? would it simply be a case of removing
PHP Code:

$forummoderators=$DB_site->query('SELECT user.userid,user.username,moderator.forumid
                                  FROM moderator
                                  LEFT JOIN user
                                    ON (moderator.userid=user.userid)
                                  ORDER BY user.username'
);
while (
$moderator=$DB_site->fetch_array($forummoderators)) {
  
$imodcache["$moderator[forumid]"][] = $moderator;
  
$mod["$moderator[userid]"] = 1;
}
$DB_site->free_result($forummoderators);
unset(
$moderator); 

from the index.php file, or are there other bits that i've missed? i already have removed the mod columns on forum home etc etc

many thanks in advance :)

Xenon 05-28-2003 10:36 PM

just remove that part yes :)

base 05-28-2003 10:48 PM

thank you very muchly, one down, now at 27. i'm thinking about using filburts mods to lower it some more still.

Erwin 05-29-2003 07:18 AM

Quote:

Today at 08:43 AM Boofo said this in Post #24
But if you have the Miderators listed like they do here on vb.org (Moderated By: ), you still need it right?
???

You just edit the template... is that what you mean?

Tubbie 05-29-2003 08:37 AM

another nice hack from u!

greetz Sebi

*install*

Boofo 05-29-2003 08:54 AM

Quote:

Today at 03:18 AM Erwin said this in Post #31
???

You just edit the template... is that what you mean?

Do I still need the moderator cacheing code in the index.php for the Moderated By: ?

Xenon 05-29-2003 09:53 AM

If you want it like vb.org you must cache the mods in the forumtable (my hack) or use the standart method ;)

Alien 05-30-2003 02:00 AM

Anyone have any ideas on this? :)

https://vborg.vbsupport.ru/showthrea...746#post400746

Xenon 05-30-2003 01:21 PM

as i already said, you can use every line of filburts hack which doesn't modify the same codeblocks than my hacks and they'll work together perfectly :)

Alien 05-30-2003 06:28 PM

Okay just wanted to be extra careful not to break anything. :)

I'll give it a whirl!

gmarik 06-05-2003 02:24 PM

Filburt - it's fantastic!

Hobbes 06-07-2003 05:34 AM

excellence!!!!! my forumhome is loading great, along with showthread!!! YAY!!! ....sadly, the forumhome stats hack by TECK ( i think :o ) doesnt work on my forums :( *cries*

ImportPassion 06-13-2003 09:52 PM

mine is pretty good. I have 305 PM's.


All times are GMT. The time now is 06:14 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.01295 seconds
  • Memory Usage 1,818KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (4)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
  • (40)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