Re: performance improvement using include(), possible to cache included code?
| From: | Stanislav Malyshev | Date: | Tue, 13 Jun 2000 16:29:23 +0000 |
| Subject: | Re: performance improvement using include(), possible to cache included code? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-21216@lists.php.net to get a copy of this message | ||
w>> I do *not* want a programmer to *modify* the Application file, because
w>> he then would have to *modifiy a complex script* and at least insert the
w>> code two time (pre-calculation how much time the script ought to need,
w>> the actual mass-executing of the code to be tested). Instead the user
w>> could use the two given User-Files.
w>>
w>> Extract: Some code from an external file should be evalulated every
w>> time, but not read every time.
So, why can't you use require, I don't see?
Another solution - use create_function (or whatever name was decided on
lambda at the end) to compile the code and then run it multiple times.
w>>
w>> <?php
w>> $string=<<<END
w>> $i+1;
w>> $a='test';
w>> END;
w>> ?>
w>>
w>> It is simply *impossible* to store the real *unevalulated* string
w>> >> $i+1;\n$a='test'; << into $string, because HERE DOCS evalulate
w>> >> every
w>> line (@dave: that?s perhaps the *reason of slowlyness*) - it would be
Wrong. Heredoc evaluates nothing, it just resolves variables. But I think
that's what you were meaning. Use \$ instead of $ if you don't want it
(yes, preg_replace on user-supplied data). Or use create_function.
w>> VERY handy if one is able to use here docs (or another, similar syntax)
w>> which *stores everything* between the start/end marks without
w>> evalulation (very fast, evalulation of code from other files is possible).
w>> Extract: Option(?) to tell <<< not to evalulate code between start/end
w>> markers
Well, I see. Perl has <<"MARK" and <<'MARK' for this.
--
Stanislav Malyshev stas@zend.com
+972-3-6139665