Re: phpng: Refactored PHP Engine with Big Performance Improvement

From: Date: Tue, 13 May 2014 06:05:14 +0000
Subject: Re: phpng: Refactored PHP Engine with Big Performance Improvement
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Tue, May 13, 2014 at 3:55 AM, Rasmus Lerdorf <[email protected]> wrote:

> On 5/12/14, 12:56 PM, Dmitry Stogov wrote:
> > FastCGI (non-PIC)  537 req/sec
> > mod_php (non-PIC) 555 req/sec
> > mod_pgp (PIC)       463 req/sec
> >
> > with non-PIC code mod_php is a bit faster than FastCGI (as expected).
> >
> > PIC makes a big difference on x86.
>
> I wonder if the difference is as large on x86_64. You tested only on
> 32-bit x86, right?
>
>
yes, 64-bit is almost always a bit slower because of bigger memory transfer
and more often cache misses.

FastCGI (x86_64)  527 req/sec

(all the benchmarks were done on the same machine with phpng built from the
same sources and with the similar configure options).


> Also, even with FastCGI, you are going to be linking in a whole bunch of
> PIC shared libraries. So in a realworld app that makes lots of calls
> into these libraries you are still going to have jump table function
> call overhead.
>

external functions are not so affected by PIC, because they usually do some
significant work and not just addition or comparison of two values, that
our VM handlers do.


>
> Another thought. Since PIC overhead is on function calls and our default
> VM is CALL, perhaps using SWITCH or GOTO instead might help here? And if
> it does it might make sense to change the default now that the world is
> 64-bit and we can't compile non-PIC anymore.
>

Even in this 64-bit world, I would suggest to try 32-bit PHP. In most cases
it shows better performance.
X32 ABI would be ideal, but it's not widely supported yet.

Anyway, PIC doesn't make significant slowdown on x86_64, because of
additional CPU registers and special PIC support.

We tried GOTO executor and, of course, it's faster.
Actually, after all the optimizations, instruction dispatch overhead became
more and more significant,
so we will have to think about it.

Thanks. Dmitry.



>
> -Rasmus
>
>


Thread (123 messages)

« previous php.internals (#74142) next »