Well, IMHO it's better to use PHP. My reasoning is this: you want to hit the
db and get out of there as quick as possible since you have limited threads.
Plus, I try to keep my code as db agnostic as possible, so that it's
portable. Having said that, if it's a quick project or something simple, I'd
probably use the mysql version just for the ease of use factor. 

If you really care, just make a program like this and do some MD5() calls in
both mysql and php to see which is faster. I'd be curious to know as well...
You'll have to modify appropriately, and only do a single MD5 check because
I think looping 10000 mysql MD5 calls will be slower automatically since
there is the connection to the db and stuff to contend with, so keep that in
mind.


Daevid Vincent
http://daevid.com

--- test ---

<?php
function getmicrotime(){ 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
} 

$ITERATIONS = 10000;

$time_start = getmicrotime();
for ($i = 1; $i < $ITERATIONS; $i++)
{
        ?>
        blah <?=$i?>
        <?php
}
$time_end = getmicrotime();
$time1 = $time_end - $time_start;

$time_start = getmicrotime();
$tf = TRUE;
for ($i = 1; $i < $ITERATIONS; $i++)
{
        echo "blah ".$i."\n";
}
$time_end = getmicrotime();
$time2 = $time_end - $time_start;

echo "<P>version one: \t$time1 seconds<P>\n";
echo "version two: \t$time2 seconds<P>\n";
?>

 

> -----Original Message-----
> From: Sid [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 25, 2003 1:25 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Use PHP or MySQL
> 
> 
> Hello,
> 
> This question has been lingering in my mind for some time -
> Say we have a function such as MD5, which is available on 
> both PHP and MySQL? Which is faster - the PHP version or the 
> MySQL one. Have any benchmarks been made on this? We can use 
> the same question for say... arithmetic operations, string 
> contentation...
> 
> Thanks in advance.
> 
> - Sid 
> 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to