Who wants to race :wink:

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Who wants to race :wink:

Post by Benjamin »

This is a neat bit of code that I found...

Code: Select all

<?php
function getmicrotime()&#123; 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
    &#125; 

$time_start = getmicrotime(); 
    
for ($i=0; $i < 1000; $i++)&#123; 
    //do nothing, 1000 times 
    &#125; 

$time_end = getmicrotime(); 
$time = $time_end - $time_start; 

echo "Did nothing in $time seconds";
?>
On my box this returned..
Did nothing in 0.0010370016098022 seconds
Anyone wanna race :twisted:
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

Did nothing in 0.0068190097808838 seconds :cry:
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Did nothing in 0.00066101551055908 seconds :D :D :D

Do nothing yourself!
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Jason you can't cheat and use a network server with 2 Pentium 2.2 chips and 1gb of ram lol

Well I guess you can...
User avatar
enygma
Site Admin
Posts: 175
Joined: Fri Apr 19, 2002 8:29 am
Location: Dallas, Tx

Post by enygma »

Did nothing in 0.00065898895263672 seconds

ph33r m3.
fluidman
Forum Newbie
Posts: 3
Joined: Fri May 24, 2002 2:46 pm

Post by fluidman »

Did nothing in 0.00064897537231445 seconds

w00t
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

7.32164895637121754

lol
man my computer is slow ;)
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post by lc »

ahem
Did nothing in 0.16882300376892 seconds
Well for a winme laptop ;)
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Did nothing in 0.0059289932250977 seconds
on my k6-2/450 apache 2.0.36/prefork PHP/4.2.1
User avatar
fatal
Forum Contributor
Posts: 118
Joined: Sat Apr 20, 2002 10:47 am
Location: East Coast

Post by fatal »

Did nothing in 0.00067305564880371 seconds - 0wnage :D
MattF
Forum Contributor
Posts: 225
Joined: Sun May 19, 2002 9:58 am
Location: Sussex, UK

Post by MattF »

Did nothing in 0.0092679262161255 seconds - on a AMD Duron 600MHZ with 256MB RAM, how's that?
Gath
Forum Newbie
Posts: 20
Joined: Wed May 15, 2002 8:36 pm

Post by Gath »

Did nothing in 0.050192952156067 seconds

PII 233, 64RAM...
User avatar
NetDragonX
Forum Newbie
Posts: 15
Joined: Sat May 25, 2002 3:00 pm
Location: Southern California

Post by NetDragonX »

Bleh - I guess I need a faster system:

Did nothing in 0.00087606906890869 seconds

Did that on a 1.4Ghz P4 - 128 SDRAM.
User avatar
sam
Forum Contributor
Posts: 217
Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:

Post by sam »

Did nothing in 0.00076940832138062 seconds... :)

Amd Athlon 1400mhz, 1gig RAM... Windows XP Pro, 2000 server (tested both server was slower ???) :)

Cheers Sam
Tiimmy
Forum Commoner
Posts: 38
Joined: Sat Apr 27, 2002 1:56 am
Location: Australia
Contact:

Post by Tiimmy »

Did nothing in 0.00000007265390261 seconds
Can anyone say GOD??? :twisted: :twisted: :twisted: :twisted: :twisted:
Post Reply