#18683 [Opn->Ana]: Performance boost of require()
| From: | rasmus@php.net | Date: | Thu, 01 Aug 2002 15:13:39 +0000 |
| Subject: | #18683 [Opn->Ana]: Performance boost of require() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-15745@lists.php.net to get a copy of this message | ||
ID: 18683
Updated by: rasmus@php.net
Reported By: tiele@staff.start.be
-Status: Open
+Status: Analyzed
Bug Type: Feature/Change Request
Operating System: Unix
PHP Version: 4.2.1
New Comment:
Wouldn't it make more sense to simply require the file once, but in the
required file, put whatever it is the file does inside a function.
Then call that function 1000 times. It would seem to me that this is
exactly the functionality you are looking for.
Previous Comments:
------------------------------------------------------------------------
[2002-08-01 10:38:53] nohn@php.net
I think the best thing would be storting this in SRM (www.vl-srm.net)
------------------------------------------------------------------------
[2002-08-01 10:19:01] tiele@staff.start.be
Hey, this is not a real feature request or a bug... just something
that came to my attention when benchmarking my script. I have added a
note on the require() page with the script and some explination.
I have a script that requires the use of other php scripts. Some of
them over a 1000 times (think of a template for a hyperlink). Normally
i would 'require' this file 1000 times but when thinking this over,
this would mean that there would be 1000 times disk activity.
When storing the contents of that other php script into a string and
evaluating this 1000 times i noticed this was 10 to 100 times faster.
Perhaps it would be possible to either adjust the require() function or
to add require_stick() that would hold this template in it's memory
until the main script is done or some flush is done.
Just trying to put out a helping hand. Keep it up !
Greets from belgium,
Tiele
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18683&edit=1