Reply to Re: Performance impact of "require"ing lots of source?

Your name:

Reply:


Posted by Jerry Stuckle on 03/28/07 02:05

lister wrote:
> Hi all,
>
> I have a fairly diverse range of data that I want to cache in the
> session rather than pulling it from the database on every page
> refresh.
>
> The problem is is that it seems that PHP requires the class
> definitions available on EVERY page, as it unserialises everything
> even if it's not going to be used.
>

Yes, if you're going to use a class, it must be defined first. Of
course, if you don't need to use the class, you don't need to define it.

> This has put me in the worrying situation of having to "require"
> pretty much every class definition in my project on every page, and
> I'm concerned about the performance impact this is going to have due
> to PHP having to parse reams of code every time.
>

If your project is that disorganized, then you will have to do it. My
projects typically have dozens of classes, and most pages require only
3-4. A few might require a couple of more.

> Are there any elegant ways around this? Am I worrying over nothing?
>

I don't know if you're worrying over nothing or not. Are you observing
a performance problem.


> Cheers,
> Lister
>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация