Kiwibonga Advance Message Boards
Register | Member List | Site main | Board main
Login
Login:
Password:
2 user(s) online: 2 guests - 314 visitors in the last 24 hours.

Pages: 1
Post Reply
   Kiwibonga Advance > Kiwibonga Advance Boards > General Chat > Testing something
 
@kiwibonga
I own two websites now. It sucks. :P
Posts: 674/717

The President of Spainmark



Location: Montreal, Quebec, Canada
[E-mail]
[AIM]
Last Activity: 3082 day(s) and 15 hour(s) ago
Registered: Sep 16 2002
Posted on 09/27/2004 at 05:04:44AM Quote

Wicked fast, baby.

Yeah... I decided to get rid of that horrible code that recounts how many threads there are in every friggin forum and does all that stupid crap to resynchronize everything when you post... So I think post/thread counts for forums (in the forum index) don't update anymore unless I trigger it... On the plus side it doesn't take 5-10 seconds before your post gets posted. Hooray.

Also I realized that it took 1.5 seconds to see the last 100 posts. I was in shock when I saw the highly unoptimized code I had there.

So I replaced it to something optimized, changed the total number of mysql queries from a few hundred to one.

Well fucking guess what, still 1.5 seconds. There is no rational explanation.

This:
$numlast=getnum("SELECT id FROM board_posts ORDER BY time DESC LIMIT 100");
for($i=0;$i<$numlast;$i++)
{
$thispost=getarray("SELECT id, thread, author, time FROM board_posts ORDER BY time DESC LIMIT $i,1");
$thethread=getarray("SELECT subject, numposts FROM board_threads WHERE id=$thispost[thread] LIMIT 1");
if($_COOKIE[cookieid]){$u=getarray("SELECT ppp FROM userstats WHERE id=$_COOKIE[cookieid] LIMIT 1");$ppp=$u[ppp];}
else{$ppp=30;}
$refpage=floor(($thethread[numposts]-1)/$ppp);
$lastmbp.="<tr><td><a href=thread.php?id=$thispost[thread]&page=$refpage#$thispost[id]>$thethread[subject]</a></td><td>".dispuser($thispost[author])."</td><td>".telldate($thispost[time])." ".telltime($thispost[time])."</td></tr>";
}


got changed to this:

$query=mysql_query("SELECT
board_posts.id AS postid, board_posts.thread AS postthread, board_posts.time AS posttime, board_posts.author AS postauthor,
board_threads.subject AS threadsubject, board_threads.numposts,
users.name AS authorname
FROM board_posts, board_threads, users
WHERE board_threads.id=board_posts.thread
AND users.id=board_posts.author
ORDER BY posttime DESC LIMIT 100");

if($_COOKIE[cookieid]){$u=getarray("SELECT ppp FROM userstats WHERE id=$_COOKIE[cookieid] LIMIT 1");$ppp=$u[ppp];}
else{$ppp=30;}

while($postlist=mysql_fetch_array($query))
{
$refpage=floor(($postlist[numposts]-1)/$ppp);
$lastmbp.="<tr><td><a href=thread.php?id=$postlist[postthread]&page=$refpage#$postlist[postid]>$postlist[threadsubject]</a></td><td><a href=http://www.kiwibonga.com/gba/profile.php?id=$postlist[postauthor]>$postlist[authorname]</a></td><td>".telldate($postlist[posttime])." ".telltime($postlist[posttime])."</td></tr>";

}


And it's still as slow. I just don't get it.

Edit: Still as slow. This site can eat me :D
-----------

Edited by kiwibonga on 09/27/2004 at 12:11:49AM
Edited by kiwibonga on 09/27/2004 at 12:13:27AM
Edited by kiwibonga on 09/27/2004 at 12:15:03AM
+Chaos
Wearer of the Pants of Justice
Posts: 1207/1281

Nahime



Location: Over there
[E-mail]
[AIM]
Last Activity: 6247 day(s) and 4 hour(s) ago
Registered: Jan 12 2003
Posted on 09/27/2004 at 04:49:39PM Quote







*pretends to understand*

Yep...
-----------
Suppo
I am the Boss of You Now
Posts: 692/712

The President of Spainmark



Location: Montreal, Quebec
[E-mail]
[AIM]
Last Activity: 7449 day(s) and 2 hour(s) ago
Registered: Oct 20 2002
Posted on 09/28/2004 at 12:58:10AM Quote

Here's my two cents opinion

I personnally just learned today in my "introduction to photoshop" class what were bytes and bits...

yep... I'm not so sure I'll keep going to that class that long.
-----------
We're going streaking!!!!!!!
@kiwibonga
I own two websites now. It sucks. :P
Posts: 675/717

The President of Spainmark



Location: Montreal, Quebec, Canada
[E-mail]
[AIM]
Last Activity: 3082 day(s) and 15 hour(s) ago
Registered: Sep 16 2002
Posted on 09/28/2004 at 03:30:28AM Quote

hehehe, if you have any trouble with that class, you know who to ask ;p
-----------
Angel of Doom
Keep Top Eye Open!
Posts: 456/462

Dooreye



Location: anywhere i can log onto
[E-mail]
[AIM]
Last Activity: 7265 day(s) and 17 hour(s) ago
Registered: Apr 25 2003
Posted on 09/30/2004 at 02:54:03AM Quote

Dammit Kiwi! I'm having trouble writing a basic bank java code, and your optimizing your SQL queries!
-----------
"These shoes arent cheap. They're made from baby skin you know. Fresh daily."
- In the immortal words of King Steve
+Hyena
<--- He is an evil genius
Posts: 857/957

The President of the Country



Location: The Fortress of Searing Pain and Occasional Ice Cream
[E-mail]
[AIM]
Last Activity: 6069 day(s) and 5 hour(s) ago
Registered: Oct 31 2002
Posted on 09/30/2004 at 04:31:00AM Quote



Uhm, I realize that 1.5 seconds is terribly inefficient for you, but I mean, waiting 1.5 seconds is not a terrible strain on a forum-goer's patience.
-----------

+Chaos
Wearer of the Pants of Justice
Posts: 1208/1281

Nahime



Location: Over there
[E-mail]
[AIM]
Last Activity: 6247 day(s) and 4 hour(s) ago
Registered: Jan 12 2003
Posted on 09/30/2004 at 09:57:04PM Quote







Yes it is. That's a second and a half I'll never get back!
-----------
@kiwibonga
I own two websites now. It sucks. :P
Posts: 676/717

The President of Spainmark



Location: Montreal, Quebec, Canada
[E-mail]
[AIM]
Last Activity: 3082 day(s) and 15 hour(s) ago
Registered: Sep 16 2002
Posted on 09/30/2004 at 11:50:03PM Quote

Basically, given the speed of the host (I can get around 465k/s which I didn't know my connection could reach), 1.5 seconds is huge! It's almost enough time to download 1Mb of data!
-----------
+Zem
Posts: 34/52

Man With A Stick



Location: Pojoaque, NM
[E-mail]
[AIM]
Last Activity: 7845 day(s) and 9 hour(s) ago
Registered: Jan 9 2003
Posted on 10/01/2004 at 08:00:57PM Quote

The point is, if it's taking 1.5 seconds to select 100 rows in a simple query, something is wrong. Which could be bad. Probably not, but better safe than sorry, right?

Maybe your sql server just sucks balls. :D
-----------
We don't need the ladies crying 'cause the story's sad
Because the Rocky Mountain Way is better than the way we had
arr
@kiwibonga
I own two websites now. It sucks. :P
Posts: 699/717

The President of Spainmark



Location: Montreal, Quebec, Canada
[E-mail]
[AIM]
Last Activity: 3082 day(s) and 15 hour(s) ago
Registered: Sep 16 2002
Posted on 01/03/2005 at 04:42:04AM Quote

Haha... Let's gravedig!

Imagine having a book with 8000 chapters, and you want to get chapter #930... But they're not actually in the correct order... And you don't have an INDEX!

That's pretty much what was happening... I forgot to set indexes on the id numbers of posts, usernames, threads, etc...

So that 1.5 second query is down to a more normal 0.2 seconds :D

*bows*
-----------
+Chaos
Wearer of the Pants of Justice
Posts: 1227/1281

Nahime



Location: Over there
[E-mail]
[AIM]
Last Activity: 6247 day(s) and 4 hour(s) ago
Registered: Jan 12 2003
Posted on 01/03/2005 at 05:39:01AM Quote







Good job. And it only took you three months to boot. :P
-----------
 
   Kiwibonga Advance > Kiwibonga Advance Boards > General Chat > Testing something
Post Reply
Pages: 1

© 2002 Kiwibonga.com - 158.0244 visitors per day - rendered in 0.036 seconds.