Re: RE: Optimizer discussion
| From: | Rob Nicholson | Date: | Sun, 07 Jun 2009 11:55:08 +0000 |
| Subject: | Re: RE: Optimizer discussion | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44198@lists.php.net to get a copy of this message | ||
Graham, Paul,
Paul Biggar <paul.biggar@gmail.com> wrote on 07/06/2009 02:28:48:
>
> On Fri, Jun 5, 2009 at 11:23 PM, Nuno Lopes<nlopess@php.net> wrote:
>
> > About runkit & friends, I wouldn't worr
> much about them. If you're running
> > them problably you also don't care about optimizations. If you want to
be
> > able to optimize something, you need to remove as many freedom degrees
as
> > you can..
>
> This is probably true of runkit. However, I would be careful what you
> remove for extra freedom. There is very likely PHP code out there that
> relies (possibly by accident) on some edge cases.
>
Firsly its great to see more and more folks experimenting with the
implementation
of PHP. I think this will be good for the wider PHP community as the
design
of PHP and the possible optimisations become better understood.
I think you'll find that there are a lot of "edge cases" as Paul mentions
in PHP that PHP code relies on. I work on IBM's project zero and we have
hit
quite a lot of them. Just one example to illustrate.
We found that the evaluation order within assignments is not at all what
you
might predict and that existing PHP applications actually rely on the
evaluation
order. Consider the following where foo() bar() and baz() have some
coupling.
$a[foo()]=$b[bar()][baz()];
Even though the test coverage of the Zend Engine as measured by line
coverage is
fairly complete we found that there were missing testcases to verify this
behaviour. We've been following a policy of writing new tests for any such
behaviour
that we find so I would suggest that you ensure that you can run and
pass all the PHPT tescases under /tests/lang and under /Zend.
For example the tests for the behaviour I mention above are
tests/lang/engine_assignExecutionOrder_XXX.phpt
Then if you find any more PHP code that does not run the same optimised as
it
does unoptimised it would be great if you could contribute testcases for
them.
Actually for full disclosure I should say that although most of the tests
we have
written are now in cvs, we are still a little behind with contributing all
the
engine tests we have written. Hopefully they'll all be there before you
need them.
Rob Nicholson
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU