Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Super Speedy UserCP Details »
Super Speedy UserCP
Mod Version: 1.01, by Birched (Member) Birched is offline
Developer Last Online: Jul 2019 I like it Show Printable Version Email this Page

vB Version: 3.8.4 Rating: (5 votes - 4.80 average) Installs: 54
Released: 08 Aug 2009 Last Update: Never Downloads: 0
Supported Code Changes Re-usable Code Translations  

TIME TO INSTALL: 10 seconds (requires editing of one file in one place)

This simple code modification increases my usercp.php loading speed by 6x. I think it will be most useful in cases where there are many subscribed forums.

It is listed as a modification for version 3.8.3 (which I am currently working with), but this mod works as far back as 3.0.1 (the 'find' text might be slightly different, but the function name and the text you replace is the same).
EDIT: Tested up to 3.8.4.

It works because the php function is_array() is excruciatingly slow, and an empty array gives the same return value as an empty variable.

This code would likely break if someone introduced a location in the code where the $lastpostarray variable was set to something (i.e. not nothing) that was not an array.

There are lots of these checks in the vBulletin code. It's likely that further speed increases could be achieved by changing more of them -- just remember that there is an unlikely circumstance (see previous paragraph) where it would cause problems. If you find other locations with significant effects, please post them in a reply!

##### IN FILE

functions_forumlist.php

##### FIND

function construct_forum_bit($parentid, $depth = 0, $subsonly = 0)
{
global $vbulletin, $stylevar, $vbphrase, $show;
global $imodcache, $lastpostarray, $counters, $inforum;

// this function takes the constant MAXFORUMDEPTH as its guide for how
// deep to recurse down forum lists. if MAXFORUMDEPTH is not defined,
// it will assume a depth of 2.

// call fetch_last_post_array() first to get last post info for forums
if (!is_array($lastpostarray))

##### REPLACE

if (!is_array($lastpostarray))

##### WITH

if (!$lastpostarray)

#####

And that's it! Enjoy, and I hope it helps!

Download Now

Only licensed members can download files, Click Here for more information.

Supporters / CoAuthors

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
End-User Options Change your UserCP Navbar with the New UserCP Dropdown Menu! Nоrman vBulletin 3.7 Add-ons 40 10 Jun 2009 19:43
End-User Options GTUserCP - Enhanced USERCP Interface + USERCP Menu Princeton vBulletin 3.6 Template Modifications 440 19 Jun 2008 21:00

Comments
  #2  
Old 08 Aug 2009, 18:30
erel34's Avatar
erel34 erel34 is offline
 
Join Date: Dec 2007
thanks
__________________
Reply With Quote
  #3  
Old 08 Aug 2009, 21:11
down.low down.low is offline
 
Join Date: Mar 2009
One mistake:
##### REPLACE

if (!is_array($lastpostarray))

##### WITH

if (!i$lastpostarray)

#####
if (!i$lastpostarray)

should be the following:

if ($lastpostarray)
Reply With Quote
  #4  
Old 08 Aug 2009, 22:21
Birched Birched is offline
 
Join Date: Sep 2007
Thanks - fixed.

EDIT: To be clear -- there used to be a typo with an 'i'. The correct replacement is what is stated in the original post, and not what is stated in the post before this one.

i.e. the following is correct:

##### REPLACE

if (!is_array($lastpostarray))

##### WITH

if (!$lastpostarray)

#####

Last edited by Birched; 15 Jul 2012 at 20:36.
Reply With Quote
  #5  
Old 08 Aug 2009, 23:16
Kolbi's Avatar
Kolbi Kolbi is offline
 
Join Date: Mar 2009
Real name: Matthias
Are there other comments about the lower loading time?
Reply With Quote
  #6  
Old 08 Aug 2009, 23:24
relaxiha relaxiha is offline
 
Join Date: Jan 2009
If you put together the best images is to be determined
Reply With Quote
  #7  
Old 08 Aug 2009, 23:38
Kolbi's Avatar
Kolbi Kolbi is offline
 
Join Date: Mar 2009
Real name: Matthias
Originally Posted by relaxiha View Post
If you put together the best images is to be determined
???
Wrong thread?
Reply With Quote
  #8  
Old 09 Aug 2009, 00:14
gearspro gearspro is offline
 
Join Date: Jun 2009
Thanks i wouldnt say 6x quicker but it is faster

Didnt work the 1st time tryed again then it worked, must of done something wrong.
Reply With Quote
  #9  
Old 09 Aug 2009, 01:17
Birched Birched is offline
 
Join Date: Sep 2007
Based on microstats, I went from 32 seconds to 5 seconds with this one change (caching was turned off at the time). I saw a similar improvement when I did this with older boards. It will definitely depend on the number of times the code loops through that call -- so if you have more subscribed forums, or forums with more content, it will help more.

Others are definitely invited to post their measurements here. I'd be interested in how much it helps in other situations.
Reply With Quote
  #10  
Old 09 Aug 2009, 01:47
hotwheels hotwheels is offline
 
Join Date: May 2005
Real name: Doug
Wow that is pretty kewl..........I would have to say it is atleast 6x faster.

thanks a bunch.
Reply With Quote
  #11  
Old 09 Aug 2009, 07:12
jambo_1969 jambo_1969 is offline
 
Join Date: May 2007
It is a bit quicker, HOWEVER, it zero's all the stats from the main forum.php page - so it looks like there are no posts and no views.
Reply With Quote
  #12  
Old 09 Aug 2009, 07:29
Birched Birched is offline
 
Join Date: Sep 2007
That doesn't happen for me at all -- check your braces (it sounds like you may have corrupted the surrounding function?), and if that doesn't fix it, then post in your change here for me to look at (or pm it.)
Reply With Quote
  #13  
Old 09 Aug 2009, 08:54
unp unp is offline
 
Join Date: Oct 2008
Originally Posted by down.low View Post
One mistake:


if (!i$lastpostarray)

should be the following:

if ($lastpostarray)
Originally Posted by Birched View Post
Thanks - fixed.
Its still ' if (!$lastpostarray)' in the frst post.
So what should it be ?
__________________
UNP
Reply With Quote
  #14  
Old 09 Aug 2009, 10:12
jambo_1969 jambo_1969 is offline
 
Join Date: May 2007
Originally Posted by unp View Post
Its still ' if (!$lastpostarray)' in the frst post.
So what should it be ?
I'm assuming the one in the OP, as I put the amended one from the later post in, and it zero'ed all post/view counts on forum home.
Reply With Quote
  #15  
Old 09 Aug 2009, 11:41
unp unp is offline
 
Join Date: Oct 2008
I get and error with if (!$lastpostarray)


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

With if ($lastpostarray) All post/view are Zero on forumhome.
__________________
UNP
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 04:15.

Layout Options | Width: Wide Color: