Re: Does class length slow down performance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ashley Sheridan wrote:
> On Thu, 2010-07-22 at 10:49 +0200, Sebastian Ewert wrote:
> 
>> Hi,
>>
>> I'm developing an joomla component and my helper an user classes are
>> crowing bigger and bigger. The helper class is for static use only.
>>
>> Does class size decrease performance of my php scripts, even for static
>> usage?
>> Is there a general rule when to split a class to keep performance up?
>>
>> Thanks for reply,
>> Sebastian
>>
>>
> 
> 
> How big roughly are we talking here? The larger a script or class is,
> the more memory this uses per instance. Out of the box, PHP doesn't have
> a way to share the memory space of libraries and classes, so creating
> massive scripts for a website is not a great idea.
> 

The user object contains 850 Lines and about 50 functions. It also
implements 2 table-objects (DB Tables).
The helper class contains 500 Lines.

> The typical approach is to break classes down into blocks such that you
> need only include per script what you actually need to run that script.
> 
> For example, having a full class dedicated to user management would need
> somewhere to create a list of users. Now it doesn't make sense to
> include this user management class each time you want to create a list
> of users, so you could split that method off into a different class
> where it can easily be shared without every script loading in lots of
> unnecessary code.

Thats exacty the point. In my user class I have functions whitch return
object-lists of diffrent users or strings with html-form elements for
managing this user account.

But if I put all these in a helper class I would anyway need to
implement the user object there, because of the other getter functions
(getUserName etc.) and the table-objects.

I always thought this would be less effective, because I have more
instances of objects.

Thanks,
Sebastian



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux