You are here: Re: [PHP] Include file « PHP « IT news, forums, messages
Re: [PHP] Include file

Posted by John Nichel on 03/31/05 00:45

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@kegworks.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация