Re: include vs. function
| From: | Charles Killian | Date: | Wed, 23 Aug 2000 07:30:10 +0000 |
| Subject: | Re: include vs. function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13102@lists.php.net to get a copy of this message | ||
First off, PHP running as an Apache module is so fast it probably doesn't
matter. But that being said, PHP is very quick and the slow down, as you
mentioned, would probably be the disk access. So I'm willing to bet Scenario
1 is at least .003 seconds slower because of the 3 extra disk accesses.
If you are accessing a database, that will be your bottleneck.
Charles
----- Original Message -----
Subject: [PHP] include vs. function
Hey all,
I am wondering as far as performance which would be better?
#######
# Scenario 1
#######
include("file.php");
include("file.php");
include("file2.php");
include("file2.php");
#######
# Scenario 2
#######
include("file.php");
function1();
function2();
function1();
I don't know the internal workings of php. But I see a few possible outcomes
here. In Scenario 1 it loads each include into memory and caches all of
them, Quickly eating memory. OR it loads 1 of them in to memory dumps it,
gets it again, dumps it, etc. Causing a lot of disk I/O and causing a
potential bottleneck. I think you can imagine all the possibilities here. So
what would be best?
Thanx,
Jess
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net