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) {
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.
Your
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
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 call, a
But, my friend, if you include that file, PHP _still_ has
to parse it. You just didn't benchmark. No matter what
?php
big_code_inline;
(which PHP has to interpret)
?
will beat
?php
include file_with_big_code_inline
(which PHP has to interpret)
?
because of
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
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,
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
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
9 matches
Mail list logo