Re: Function caching...
| From: | Ron Chmara | Date: | Sat, 09 Dec 2000 05:32:32 +0000 |
| Subject: | Re: Function caching... | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40635@lists.php.net to get a copy of this message | ||
Ulf Wendel wrote:
> Jacob Verhoeks wrote:
> > I'm developing a large web application.
> > The code is very large now (2mb).
Across, what, 30 pages? 50 pages?
(er.... PHP isn't about writing one application, on one page. It's
about writing different components which are tied on different page
calls. If you're loading 2mb of PHP for every page, that's a design
problem. 2MB of PHP across many pages of a massive accounting
package, that I can see....)
> > The performance problem is not with executing but with the loading of the
> > code. We are currently developing a application server in php. That will be
> Yes the compile (loading) time is much to long. PHP 4 need ~1 second to
> compule 8k loc on out developement server (Netra T1). The Zend Encoder
> and Zend Cache might improve this dramatically.
Roughly one second for only 8K? I'd say something was *horribly wrong* in
that 8k. If you mean that every page is lugging around 2Mb and 8K, then,
I guess you may have to write the code for more efficiency, throwing away
functions that are only called once, dumping out any OO into procedural
programming steps/loops, dumping slower db calls for ldap calls, getting rid
of layers of abstraction, ereg workflows/loops, running PHP as part of
apache (not a module) etc...
The standard things one does when optimizing PHP (or other languages,
for that matter) for speed apply to most cases, even only 8k. For example,
if that 8k held an ereg_replace loop, a series of non-persistant db
connections...
> Nevertheless in some cases it would be very nice to have a "function
> call cache" as described. Think of templates or functions working on
> large tree structures. I played around with a cache implemented on the
> user side and yes, it's getting faster...
Well, almost all of my static content *is* pulled from a disk cache...
But if you're using the same functions, repeatedly, on a tree, perhaps
you could save a lot of effort by making another tree instead (I know
this metaphor extension may not work for your case, but my point is
that speedy code is obtainable in many different ways...)
I would like it if the processes could "preload" functions (say, things like
metabase, or standard global app libraries) into a closer cache. But thats
not the same as caching page results.. if the results were that static,
there's not much point in using PHP to make them, is there? Can't you
put it in a file, use good disk caching, and call the file from your
RAM?
Devil's Advocate,
-Bop
--
Personal: ron@opus1.com, 520-326-6109, http://www.opus1.com/ron/
Work: rchmara@pnsinc.com, 520-546-8993, http://www.pnsinc.com/
The opinions expressed in this email are not neccesarrily those of myself,
my employers, or any of the other little voices in my head.