Re: optimal code

From: Date: Thu, 05 Jul 2001 12:53:02 +0000
Subject: Re: optimal code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56304@lists.php.net to get a copy of this message
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 magnitude slower that PHP running through it... ------ > On Thu, 5 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 defines ~40 functions, with > > the bodies > > included when the function is called. Eg: > > > > function blah(){ > > > > return include('includes/func.blah.inc'); > > } > > > > 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 then available. > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Justin Farnsworth Eye Integrated Communications 321 South Evans - Suite 203 Greenville, NC 27858 | Tel: (252) 353-0722

« previous php.general (#56304) next »