Jump to content

Optimization for uncalled Functions.


omkarkhair

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/222877-optimization-for-uncalled-functions/
Share on other sites

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.

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.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.