Zeev,

>> Maybe I'm ignorant of something, but isn't the only way you can begin to
>> infer the type with real confidence is by having strict typed parameters ?
>
> Not at all.  You can definitely infer lots of type information without any
> type hints, strict or weak.  bench.php wouldn't be 25x faster and Mandelbrot
> would not be as fast as an equivalent C program if we couldn't infer types
> without type hints.  Take a look at it (Zend/bench.php) - much like you can,
> as a human, figure out that $i is an integer, and that $recen is a float,
> etc. - you can write code that will do that automatically (by taking a look
> at the assigned values, at the operators which are used, etc.)  In general.

Yes, but mandel() from bench.php isn't generic code. It is a subset of
valid code. One that wouldn't need any changes to move to strict mode.

Additionally: "would not be as fast as an equivalent C program". I
compiled mandel() using C (via PECL). It wasn't 25x faster, it was
75734.13830x faster (3000x with -O0). So no, you're way off from C
speed.

> If you haven't, please read my reply to Jefferson from yesterday:
> marc.info/?l=php-internals&m=142463029832159&w=2
> It illustrates the point as to why not only are strict types not necessary
> to do type inference, they also don't provide you with additional data that
> can help you generate better code *assuming the same input source code*.
> The bets are off if you change your code and compare how the changed version
> runs in the Strict mode and the unmodified one runs in Coercive.  But if you
> take the modified code and run it on both Strict and Coercive - you can
> reach the same results (except for the obvious, intentional functionality
> differences).

Again, please make it clear to people that you're talking about
special cases of userland code, where the rest of us are talking about
general cases.

Anthony

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

Reply via email to