|
Posted by www.gerardvignes.com on 02/02/07 19:41
Thanks I.Rezvin!
I am probably passing by value. Ugh! I need to fix that mess.
I also really appreciate the link to Lazy PHP. It looks like a great
article.
I already had to use a batch script to put all my client-side
JavaScript object files into one optimized script for deployment. That
made a tremendous improvement for the page loading time. I'm going to
do the same for the PHP code.
You have excellent advice. I am indebted to you.
Gerard
On Feb 1, 5:07 pm, "irezvin" <I.Rez...@avansite.com> wrote:
....
> I had same problems and I can recommend you several things.
>
> 1. Carefully pass your objects BY REFERENCE - always, when possible,
> use $foo = & $bar if $bar is an object; same for the functions that
> return objects; it's very important for PHP 4, also it prevents PHP
> from blowing up your memory with copies of objects.
> 2. Initialize your objects (and, if it is possible, load your classes)
> immediately before use - read good article here
> http://www.sitepoint.com/blogs/2004/02/06/lazy-php-part-1/
> Also on that: autoloading of classes in PHP5 totally rocks, but in
> PHP4 there is a sense in creating a factory function that will
> autoload classes (I did that and it really helps).
> 3. I tried the consolidation into one script (I had over 50 classes)
> and can recommend you to do it automatically (for example concat them
> into one file just in order of inheritance), because such large file
> is extremely difficult to maintain by-hand. Also note that step 2
> eliminates the need in step 3 (unless you surely and absolutely know
> that you will need all these classes on EVERY request). And I also
> haven't noticed any significant performance increase with many classes-
> in-one-file vs. many classes in separate file.
> Anyway, good luck!
Navigation:
[Reply to this message]
|