Topic awaiting preservation: PHP Script performance |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: Australia |
posted 07-27-2006 02:13
Hey, |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-27-2006 03:46
A script with less functions does run faster. |
Paranoid (IV) Inmate From: Australia |
posted 07-27-2006 05:31
Okay thanks, |
Paranoid (IV) Inmate From: Australia |
posted 07-27-2006 05:41
Actually lets say do do require_once on a file with a class and functions. Is that compiled even if you dont create an object of that class? |
Bipolar (III) Inmate From: |
posted 07-27-2006 05:52
Yes, it's parsed into memory, even if you never instantiate or call anything in that file. Once you include the file (include/require/include_once/require_once) it gets pulled into memory and parsed. So it is a good idea to split up large classes and libraries. |
Paranoid (IV) Inmate From: Australia |
posted 07-27-2006 06:31
Thanks i will have a read |
Bipolar (III) Inmate From: |
posted 07-27-2006 09:09
I considered that maybe something wasn't clear. Including a file only occurs when that code is executed ... so in this (very simple) example: code: $x = "a"; if($x == "a") { require_once("a.php"); } else { require_once("b.php"); }
|
Paranoid (IV) Inmate From: Australia |
posted 07-27-2006 10:41
Yeh i figured as much, did some testing anyways and most of my scrpipts execute in under 0.05 seconds so its all good for now. The only slow ones are due to ftp operations which seem to be slow by nature. |