PHP-Static Methods performance

Hello All,

I am jut going through the PHP static methods performance and came across this link

http://stackoverflow.com/questions/1472721/php-performance-of-static-methods-vs-functions

I use DAO layer for my website and kept all the master table data read methods in static functions , But looks like it is a performance issue , so going to create them as object level methods

For example

To get countries list , states list and cities list …

I put them like below , But now removing static keyword and going to create object of MasterGeo


class MasterGeo

{


 public static getCountries(){

	

 }




  public static getStates($countryCode){

 	

 }


  public static getCities($stateCode){

 

 }


}

Just wanted share this with you guys and please let me know if you have any comments on this

Thanks

Yii Fan

Generally the issue is so mi-nute that it’s negligible. There’s lot of these issues in PHP but it sometimes it’s worth giving way to performance in aid of userbility. OOP itself adds lots of overhead over having a non OOP application however it would become unmanageable so we give way to the performance loss in aid of a better application and ultimately our sanity.

Yes, it’s faster. But it also costs more in terms of memory.

Thank You Jaggi and jacmoe.

Jacmoe :- It is in fact reverse . static methods decreasing performance . That is what the link says

http://stackoverflow.com/questions/1472721/php-performance-of-static-methods-vs-functions

Regards

Yii Fan

No, I meant that objects costs more in terms of memory but is faster. What it said. :)

I’ve seen discussions like this about C++ - but always it’s totally negligible - I am firmly in the ‘do not optimize prematurely’ camp.

Thank You Jacmoe for the clarification