Home > Archive > PHP Programming > March 2004 > Performance comparisons?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Performance comparisons?
|
|
| Margaret MacDonald 2004-03-26, 11:17 pm |
| Has anyone done any performance comparisons between what one might
call the 'program' vs 'interjection' models?
What I'm calling the 'program' model is putting a '<?php' invocation
at the top of the page, a '?>' exit at the bottom, and doing all the
html output via echo statements.
The 'interjection' model, in contrast, repeatedly invokes php for
minimal periods instead, so instead of one mass of php code, the same
amount of code is in smaller pieces and laced in and out of the html.
The interpreter must look at everything regardless, but I'm wondering
whether there's significantly more overhead one way than the other.
From the fact that 'echo' isn't actually a function, my guess is that
the overhead might be a wash, but does anyone know of any actual
performance tests?
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
| |
| Chung Leong 2004-03-26, 11:17 pm |
| Uzytkownik "Margaret MacDonald" <scratch65536@att.not.invalid> napisal w
wiadomosci news:rlj360ht695hqk3s2nrm4d3flhblif2ttd@
4ax.com...
> The interpreter must look at everything regardless, but I'm wondering
> whether there's significantly more overhead one way than the other.
> From the fact that 'echo' isn't actually a function, my guess is that
> the overhead might be a wash, but does anyone know of any actual
> performance tests?
My guess is that injection wins by a whisker, since there's less to parse
and fewer opcodes.
| |
| Jochen Daum 2004-03-27, 11:54 pm |
| Hi Margaret,
On Wed, 24 Mar 2004 18:19:43 GMT, Margaret MacDonald
<scratch65536@att.not.invalid> wrote:
>Has anyone done any performance comparisons between what one might
>call the 'program' vs 'interjection' models?
>
>What I'm calling the 'program' model is putting a '<?php' invocation
>at the top of the page, a '?>' exit at the bottom, and doing all the
>html output via echo statements.
>
>The 'interjection' model, in contrast, repeatedly invokes php for
>minimal periods instead, so instead of one mass of php code, the same
>amount of code is in smaller pieces and laced in and out of the html.
>
>The interpreter must look at everything regardless, but I'm wondering
>whether there's significantly more overhead one way than the other.
>From the fact that 'echo' isn't actually a function, my guess is that
>the overhead might be a wash, but does anyone know of any actual
>performance tests?
I believe the performance difference is minimal in comparison to
database accesses. But with your 'program' model its impossible to
change the HTML code.
HTH, Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
|
|
|
|
|