Is it worth using require_once() for memory savings?

jcdnhomep

New Member
I'd like to check if my understanding's correct about \[code\]require_once()\[/code\]. I have a bunch of functions in file \[code\]foo.php\[/code\]. Let's say 7/8 out of them are always used, and one of them's rather rare and rather large. I have to keep this function's definition in \[code\]foo.php\[/code\]. Can you tell me if the following approach achieves anything, and if you think it's worth what it achieves.
  • Take out the body of the function and put it in an external file.
  • Redefine the original function to \[code\]require_once()\[/code\] that particular file and pass execution over to the helper function.
I understand this could save server memory on the requests where that function isn't run. What exactly am I saving though? Just the memory it takes to hold the body of the function? That would mean it would have to be a pretty big function before being worth it I guess. Also, if I'm using something like APC does it become less useful?Please correct or add to this as appropriate!Thank you very much.
 
Back
Top