omkarkhair Posted December 29, 2010 Share Posted December 29, 2010 I am using a PHP include file for my site, which includes validation functions used throughout out the site. Like string type, alphanumeric values, etc. Its completely customized for the types of user inputs the site takes. The problem is, each page uses only about 2-3 functions from the whole list of 16. One of the pages gives a memory_get_usage() of 748KB. If I remove the Inluded file, it goes down by 200KB. While the include file is of 4KB and the test page is 2KB. I am looking for a method to optimize the memory allocation. I dont want to write the code separately for each file.Is there a method to optimize for uncalled functions? Thanks in Advance. Quote Link to comment https://forums.phpfreaks.com/topic/222877-optimization-for-uncalled-functions/ Share on other sites More sharing options...
omkarkhair Posted December 29, 2010 Author Share Posted December 29, 2010 Com'on folks.. 17 views and no reply? I dont want to move ahead with an inefficient code. Quote Link to comment https://forums.phpfreaks.com/topic/222877-optimization-for-uncalled-functions/#findComment-1152467 Share on other sites More sharing options...
lastkarrde Posted December 29, 2010 Share Posted December 29, 2010 Performance difference will be negligible. Your worrying over something far too small. Look how much code Drupal/IPB/whatever includes on every request. They are quick. Using a bytecode cache (such as APC) will reduce memory usage and increase performance. Quote Link to comment https://forums.phpfreaks.com/topic/222877-optimization-for-uncalled-functions/#findComment-1152505 Share on other sites More sharing options...
PFMaBiSmAd Posted December 29, 2010 Share Posted December 29, 2010 If I remove the Included file, ... Ummm. Clearly that prevented your code on your page from executing fully, either directly due to fatal runtime errors (functions on longer being defined), or indirectly because you altered the remainder of the code on the page somehow. It would take seeing all the code that produces/reproduces the the symptom in order to be able to specifically help you (in programming that is rarely one answer that fits every situation, without knowing exactly what that situation is.) Quote Link to comment https://forums.phpfreaks.com/topic/222877-optimization-for-uncalled-functions/#findComment-1152585 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.