Re: Include file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 30 Mar 2005 16:45:32 -0500, John Nichel <john@xxxxxxxxxxxx> wrote:
> Because I'm bored, I decided to test the theory.
> 
> AMD 3200xp
> 1.5gb Memory
> RHEL AS 3
> 
> I ran the test 20 times, and 18 of those times, double quotes were
> faster than single quotes.  Don't always trust what you read.  Not to
> mention the fact that the 'faster' of the two was 'faster' by an average
> of less than .003 seconds to include 1000 files.
> 
> <?php
> 
> function microtime_float() {
>         list ( $usec, $sec ) = explode ( " ", microtime() );
>         return ( ( float ) $usec + ( float ) $sec );
> }
> 
> for ( $i = 0; $i < 1000; $i++ ) {
>         $fp = fopen ( "file_" . $i . ".php", "w" );
>         fwrite ( $fp, "<?php\n\n\n?>" );
>         fclose ( $fp );
> }
> 
> $single_start = microtime_float();
> for ( $i = 0; $i < 1000; $i++ ) {
>         include ( 'file_' . $i . '.php' );
> }
> $single_end = microtime_float();
> 
> $double_start = microtime_float();
> for ( $i = 0; $i < 1000; $i++ ) {
>         include ( "file_" . $i . ".php" );
> }
> $double_end = microtime_float();
> 
> $single = $single_end - $single_start;
> $double = $double_end - $double_start;
> 
> echo ( "Single Quotes : " . $single . " seconds.<br />\n" );
> echo ( "Double Quotes : " . $double . " seconds.<br /><br />\n" );
> 
> if ( $double > $single ) {
>         $time = $double - $single;
>         echo ( "Single Quotes are " . $time . " seconds faster than double
> quotes." );
> } else {
>         $time = $single - $double;
>         echo ( "Double Quotes are " . $time . " seconds faster than single
> quotes." );
> }
> 
> ?>
> 
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> john@xxxxxxxxxxxx
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
Here is my test in a PIII 550Mhz 128mb with gentoo:

for ($i = 0; $i <= 9999; $i++) {
      $include = 'db_connect.php';
      include('include/'.$include);
}

3.623316 seconds
--------------------------------------

for ($i = 0; $i <= 9999; $i++) {
    $include = "db_connect.php";
    include("include/$include");
}

3.696468 seconds

meatbread.

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux