include vs. function
| From: | Jesse Binam | Date: | Wed, 23 Aug 2000 07:12:54 +0000 |
| Subject: | include vs. function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13095@lists.php.net to get a copy of this message | ||
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