Re: performance improvement using include(), possible to cache included code?
| From: | Stanislav Malyshev | Date: | Tue, 13 Jun 2000 07:36:34 +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-21186@lists.php.net to get a copy of this message | ||
w>> 1.) I╢ve written a benchmark class and in order to simplify the UI I╢ve
w>> put the code the user can benchmark in another included file,
w>> I╢ve experienced an up to 90% (!!!) *performance loss* compared to
w>> *typed code* - is it possible to store included data in any type of
w>> *cache*, variable cache?
You are doing looping include? Sure you get performance loss - you are
getting read every time. Use require at least - that'll insert the thing
once.
w>> 2.) if possible I would like to avoid eval()
include is read+eval, basically.
w>> 3.) I╢ve also noticed then that there╢s *no function* which reads an
w>> *entire file into a string* (there╢s one reading a file into an array
w>> sure), I think that could be handy
That's a valid point. I really don't know why it isn't. Though, I think
you could do it with fread(filesize()).
w>> 4.) Trying to do a better workaround I╢ve tried out <<< the here docs to
w>> put the whole code into a string, then I╢ve noticed that it isn╢t
w>> possible to <<< pipe everyting between <<<ENDOFHERE and ENDOFHERE; into
w>> a (string) *without* having the code evalulated, I think this could be
w>> extremely handy too....
Err, not exactly understood what you mean. Could you give an example.
--
Stanislav Malyshev stas@zend.com
+972-3-6139665