Re: optimal code

From: Date: Thu, 05 Jul 2001 21:46:14 +0000
Subject: Re: optimal code
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56391@lists.php.net to get a copy of this message
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 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. hmm, depending on the function size I would say the parser is much faster doing that than the HDD drive reading each file from the disk and ending in lesser php code to parse. OTOH, it is not possible to do your way w/ class methods :(( I guess the ammoun of include/one-shot-code depends on the application, programming style, but somewhere they should balance. -- teodor

« previous php.general (#56391) next »