> -----Original Message-----
> From: Marcus Boerger [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 14, 2008 9:28 PM
> To: Stas Malyshev
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Patch for opcode caches
> 
> 
> Hello Stanislav,
> 
> Friday, March 14, 2008, 6:48:52 PM, you wrote:
> 
> > Hi!
> 
> >> Lemme just think, doing inheritance at compile time before we send 
> >> the stuff to an opcode cache can be slower then? How is that 
> >> possible? After all late binding means we do it at run 
> time. And no 
> >> matter how much faster we can do it. It will always be slower than 
> >> doing the same thing only once.
> 
> > I'm taking this off-list because it doesn't seem to go any 
> direction 
> > it
> > can be useful for people to read.
> 
> Hmm, so other people must not read what we discuss, that does 
> not work.
> 
> > Repeating again: it can not be done "only once". Not with opcode 
> > caches
> > present and bound entities living in separate file. This 
> thing is not 
> > possible. If you do not believe it - try to implement it and see.
> 
> That is my point. It can be done. 

Look into the example:

parent1.php
<?php
class Foo {...}
?>

parent2.php
<?php
class Foo {...}
?>

child.php
<?php
class Bar extens Foo {...}
?>

index1.php
<?php
include "parent1.php";
include "child.php";
?>

index2.php
<?php
include "parent2.php";
include "child.php";
?>

Do you still think if early-binding for class Bar is possible at
compile-time with opcode caches?
And what "Foo" is the parent?

> The reason to delay 
> inheritance is that we can have a conditional statement 
> around a class definition. 

There is no "if' statement in example above.
Also detection of conditional code is additional pine for caches.

> If we detect classes that do not 
> have conditionals around them, then we can bind them early.

It's wrong.
 
> It is as easy as that. So instead of making the language more 
> dynamic and even removing a chance of having inheritance 
> dones early where possible we should work on making the 
> desired case - eraly binding - as easy as possible.

The proposed patch allows caches to implement proper behavior of
early-biniding in most easy way. (~5 lines of code)

Thanks. Dmitry.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to