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

Posted by Xfedex on 03/31/05 01:08

On Wed, 30 Mar 2005 16:45:32 -0500, John Nichel <john@kegworks.com> 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@kegworks.com
>
> --
> 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.

 

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

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