i have heard alot of people talking about how fast there scripts parse in like 0.14 seconds etc.
just wanted to ask how you can find out?
parse times?
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
quite simple...
lets say this is a big script:
lets say this is a big script:
Code: Select all
<?php
$start_time = time();
//lines of code
//lines of code
//lines of code
//lines of code
//lines of code
//lines of code
$end = round(time() - $start_time, 3);
echo "Page parsed in ". $end." secs";
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
To get the microseconds as well try this from the PHP manual:
php.net/microtime
Mac
php.net/microtime
Code: Select all
<?php
function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
for ($i=0; $i < 1000; $i++){
// do nothing, 1000 times
}
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds\n";
?>