Hi @internals,
I'm glad to say that we have started a new JIT for PHP project and hope to deliver some useful results for the next PHP version (probably 8.0).
We are very early in the process and for now there isn't any real performance improvement yet. So far we spent just 2 weeks mainly working on JIT infrastructure for x86/x86_64 Linux (machine code generation, disassembling, debugging, profiling, etc), and we especially made the JIT code-generator as minimal and simple as possible. The current state, is going to be used as a starting point for research of different JIT approaches and their usability for PHP.
The code is available at: https://github.com/zendtech/php-src/tree/jit-dynasm/ext/opcache/jit
The sources may be built and tested as regular PHP (no any special external dependencies required).
JIT itself is implemented as a part of Opcache.
You may try it in action:
sapi/cli/php -d opcache.jit_buffer_size=32M Zend/bench.php
sapi/cli/php -d opcache.jit_buffer_size=32M -d opcache.jit_debug=1 Zend/bench.php 2>&1 | less
As I mentioned we didn't try to achieve any real performance improvement yet, although we do currently see 20% speedup on bench.php, but a bit of a slowdown on real-life apps.
Wish us luck :)
Thanks. Dmitry.
Hey:
Hi @internals,
I'm glad to say that we have started a new JIT for PHP project and hope to
deliver some useful results for the next PHP version (probably 8.0).
We are very early in the process and for now there isn't any real
performance improvement yet. So far we spent just 2 weeks mainly working
on JIT infrastructure for x86/x86_64 Linux (machine code generation,
disassembling, debugging, profiling, etc), and we especially made the JIT
code-generator as minimal and simple as possible. The current state, is
going to be used as a starting point for research of different JIT
approaches and their usability for PHP.The code is available at: https://github.com/zendtech/
php-src/tree/jit-dynasm/ext/opcache/jitThe sources may be built and tested as regular PHP (no any special
external dependencies required).
JIT itself is implemented as a part of Opcache.
You may try it in action:sapi/cli/php -d opcache.jit_buffer_size=32M Zend/bench.php
sapi/cli/php -d opcache.jit_buffer_size=32M -d opcache.jit_debug=1
Zend/bench.php 2>&1 | lessAs I mentioned we didn't try to achieve any real performance improvement
yet, although we do currently see 20% speedup on bench.php, but a bit of a
slowdown on real-life apps.
Actually, if you are lucky like me, you may see like 5% improvement on
wordpress. :)
thanks
Wish us luck :)
Thanks. Dmitry.
--
Xinchen Hui
@Laruence
http://www.laruence.com/
Is planned async/await and native event-loop (maybe libuv)?
Thank.
Hi Dmitry,
-----Original Message-----
From: Dmitry Stogov [mailto:dmitry@zend.com]
Sent: Thursday, September 1, 2016 1:57 PM
To: PHP internals list internals@lists.php.net
Cc: Zeev Suraski zeev@zend.com; Xinchen Hui xinchen.h@zend.com
Subject: [PHP-DEV] JIT for PHP projectHi @internals,
I'm glad to say that we have started a new JIT for PHP project and hope to
deliver some useful results for the next PHP version (probably 8.0).
We are very early in the process and for now there isn't any real
performance
improvement yet. So far we spent just 2 weeks mainly working on JIT
infrastructure for x86/x86_64 Linux (machine code generation,
disassembling,
debugging, profiling, etc), and we especially made the JIT code-generator
as
minimal and simple as possible. The current state, is going to be used as
a
starting point for research of different JIT approaches and their
usability for PHP.The code is available at: https://github.com/zendtech/php-src/tree/jit-
dynasm/ext/opcache/jitThe sources may be built and tested as regular PHP (no any special
external
dependencies required).
JIT itself is implemented as a part of Opcache.
You may try it in action:sapi/cli/php -d opcache.jit_buffer_size=32M Zend/bench.php sapi/cli/php -d
opcache.jit_buffer_size=32M -d opcache.jit_debug=1 Zend/bench.php 2>&1 |
lessAs I mentioned we didn't try to achieve any real performance improvement
yet,
although we do currently see 20% speedup on bench.php, but a bit of a
slowdown on real-life apps.Wish us luck :)
I just wanted to ask about the status. After starting to do some basic work
https://github.com/zendtech/php-src/compare/jit-dynasm...weltling:jit-dynasm
I've stumbled upon a couple of things
- in zend_elf.c, the current binary that loads php is being read in, I guess
this part needs to be ported to parse the Windows COFF format - with DynASM, seems zend_jit_x86.dasc will need to be extended for some
compatibility, please correct if I'm wrong
Regarding these, maybe you've one or another tip for me? Is this still
relevant? Or I jump into it too early?
Thanks
anatol