Re: [PHP] Structured Code vs. Performance



Jochem Maas wrote:
Stut wrote:
Jochem Maas wrote:
Stut wrote:
Jo chem baas wrote:

^- wtf happened here? :-) it's quite funny if you know dutch :-)

Pass. Looking back it looks like it happened one of the times I replied. Didn't do it on purpose, honest! ;)

Whether there is conditional definition or not, the opcode cache will
look the same. The reason for this is that function and class
definitions happen at runtime not compile time. This would have to be
the case for conditional definition to work at all, since the compiler
cannot determine the value of a condition at compile-time.
okay, but I was just paraphrasing the man Rasmus, although I admit I may
have misinterpreted (or misundersstood the 'why') - thought I pretty sure
he has written on a number of occasions that code like the following
sucks
for op-code caches and should be avoided:

if (foo()) {
class Foo { }
}
Hopefully he's reading and will be able to give us a definitive answer.

here is the post that I was recalling:

http://lists.nyphp.org/pipermail/talk/2006-March/017676.html

I believe his third point validates what I was saying although I did
make a bit of a mess with regard of my use of terminology.

Hmm, Rasmus seems to be saying that opcode caches have a way to optimise the definition of entities, and by defining them conditionally they can't make use of that. That kinda makes sense, but I'd expect the difference to be negligible unless you're talking about a file with thousands upon thousands of definitions.

Anyhoo, back to the coalface.

-Stut

--
http://stut.net/
.



Relevant Pages

  • Re: Watch out for 10.3 kernel (slow)
    ... yet somebody said we must be stop saying it. ... compile my own kernel, so that would mean that if I tried, I would not ... I'm NOT saying developers don't care! ...
    (alt.os.linux.suse)
  • Re: What is Forth best at?
    ... you're a robot. ... actual ability to compile on it than the hypothetical ability to ... PL/M was superficially similar to PL/I, but without the featureitis and with simple underlying semantics. ... the pretence that Stephen Pelc was saying this ...
    (comp.lang.forth)
  • Re: NEWBIE
    ... Are you saying that the Express edition cannot compile a non-CLR app? ... Regards, ...
    (microsoft.public.dotnet.languages.vc)
  • EXTERN.h not found
    ... hi all ive been trying to compile a couple of programs lately and they all ... fail with the line below saying they cant find EXTERN.h. ...
    (comp.lang.perl.misc)
  • Re: Ruby One-click Installer and ruby 18.4.
    ... with the base compile, and now I'm working on making sure that certain ... 2005 has changed its compile mechanism (and making changes to the way ... I also worked with the OpenSSL CVS ... I'm not saying everyone should go to the ...
    (comp.lang.ruby)