On Feb 23, 2015 7:43 AM, "Zeev Suraski" <z...@zend.com> wrote:
>
> > -----Original Message-----
> > From: Anthony Ferrara [mailto:ircmax...@gmail.com]
> > Sent: Monday, February 23, 2015 4:14 PM
> > To: Zeev Suraski
> > Cc: Joe Watkins; PHP internals
> > Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints
> > RFC)
> >
> > 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.
>
> I'm not sure what that means.  mandel() is an example in the very same way
> that foo() and bar() you presented were examples.  It also happens to be a
> real world example showing Joe that not only is it possible to do type
> inference without strict typing (who asked " isn't the only way you can
> begin to infer the type with real confidence is by having strict typed
> parameters?") - but it's possible to do a great job at it, too.
>
> > 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.
>
> Those were our results:
> PHPNG-JIT (JIT=on)                 0.011 (25 times faster than php-7)
> gcc -O2 (4.9.2)                    0.013
> gcc -O0 (4.9.2)                    0.022
> PHP-7                              0.281 (15 times faster than php-5.0)
> PHP-5.6                            0.379
> PHP-5.5                            0.383
> PHP-5.4                            0.406
> PHP-5.3                            0.855
> PHP-5.2                            1.096
> PHP-5.1                            1.217
> PHP-4.4                            4.209
> PHP-5.0                            4.434
>
> Something broken in your setup.  BTW, I'm not claiming our JIT is faster
> than gcc.  It's at the margin of error level.

I think without actually making the code available, this specific point is
just speculation, with all respects to the work having been done.

If the goal is to have that in PHP, please  publish now, not when you think
it is what it should be.

Doing so will allow other to test, provide feedback and maybe have ideas to
solve one or another issue.

Reply via email to