I designed my code to put all the important functions in a single PHP file, whose length is 1800 lines.
I call it in other PHP files - for example, AJAX processors - with a simple "require_once (" codeBank.php ")".
I find that it takes about 10 seconds to load all these functions, although I have nothing more than a few global arrays and many other functions. For example, the main AJAX processor code takes 8 seconds to perform a simple syntax check (whose operational function is stored in codeBank.php).
When I comment on require_once, the AJAX response time increases from 10 s to 40 ms, so itβs pretty clear that PHP is trying to do something with these 1800 lines of functions. This is even when installing APC, which is surprising.
What should I do to return the speed of my code to a level below 100 ms? Can't I get an advantage in the cache? Do I need to trim this file with one system file into different parts? Are there other subtle things that I could do to spoil my answer time?
Or to forbid all this, what are some tools which need to be dig further, what PHP operations hit on speed?
============================
[EDIT] Solved.
============================
As many of you kind people have pointed out, there is no logical reason why simply having a php 1800 function library should cause a slowdown. What actually happens is that I had a debug string that called one of the longer API call functions. Whenever I included a PHP file, I built a whole data structure from the deleted, requested data.
As soon as I killed this line, everything returned to the fast 30 ms responses. It remains strange to me that require_once () opens a php file every time an AJAX script is called. But, that I am not in shape and forget that every time the AJAX script is finished, it closes and reopens and recompiles every time.