RE: [PHP] optimal code

2001-07-05 Thread Richard Heyes
> > Having all the function bodies in the same file would cause php to have > > to parse all > > of that code, probably about 3-4000 lines causing awful slowdowns. And > > the reason to define all of > > the functions in one file, is so that we can include that file, and all > > the functions are

Re: [PHP] optimal code

2001-07-05 Thread teo
Hi Richard! On Thu, 05 Jul 2001, Richard Heyes wrote: > > If you are talking about speed, opening a file is expensive > > because it is a kernel call, a directory search and all that. > > Your "some big code" in-line will beat it every time... > > Not in my experience. I have a file which define

RE: [PHP] optimal code

2001-07-05 Thread Richard Heyes
> But, my friend, if you include that file, PHP _still_ has > to parse it. You just didn't benchmark. No matter what Actually, I did do benchmarks, you simply didn't understand correctly. Not all of the functions are used on every page. So if I were to include all the functions in one file, rou

Re: [PHP] optimal code

2001-07-05 Thread Justin Farnsworth
Nick Davies wrote: > > surely the include function only "pastes" the contents of the included > file into the point where the include statement occours. Php still has to > parse it all. --- Right, and so no matter what, you still have the extra cost of the file operation, something almost a magn

Re: [PHP] optimal code

2001-07-05 Thread Justin Farnsworth
But, my friend, if you include that file, PHP _still_ has to parse it. You just didn't benchmark. No matter what will beat because of the addition of the call to the kernel. You cannot get around this. Richard Heyes wrote: > > > If you are talking about speed, opening a file is expensi

RE: [PHP] optimal code

2001-07-05 Thread Nick Davies
surely the include function only "pastes" the contents of the included file into the point where the include statement occours. Php still has to parse it all. On Thu, 5 Jul 2001, Richard Heyes wrote: > > If you are talking about speed, opening a file is expensive > > because it is a kernel cal

RE: [PHP] optimal code

2001-07-05 Thread Richard Heyes
> If you are talking about speed, opening a file is expensive > because it is a kernel call, a directory search and all that. > Your "some big code" in-line will beat it every time... Not in my experience. I have a file which defines ~40 functions, with the bodies included when the function is ca

Re: [PHP] optimal code

2001-07-05 Thread Justin Farnsworth
This depends upon what you mean by "effective". For administration purposes, it may be that you want to include some "commen" code, and therefore not rewrite reusable bits. If you are talking about speed, opening a file is expensive because it is a kernel call, a directory search and all that. Y

Re: [PHP] optimal code

2001-07-05 Thread Thies C. Arntzen
On Thu, Jul 05, 2001 at 02:29:12PM +0300, Adrian Ciutureanu wrote: > Is any of the versions below more effective? > > /** Version 1 **/ > if($condition) { > // some big code > } else { > // other big code > } > ?> > > /** Version 2 **/ > if($condition) { >

[PHP] optimal code

2001-07-05 Thread Adrian Ciutureanu
Is any of the versions below more effective? /** Version 1 **/ /** Version 2 **/ /** Version 3 **/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAI