Re: 64-bit performance improvement by reducing zend_op size.
| From: | Xinchen Hui | Date: | Thu, 11 Dec 2014 06:42:42 +0000 |
| Subject: | Re: 64-bit performance improvement by reducing zend_op size. | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-79553@lists.php.net to get a copy of this message | ||
Hey:
On Wed, Dec 10, 2014 at 11:27 PM, Dmitry Stogov <dmitry@zend.com> wrote:
> Hi,
>
> Please, review the following patch
> https://gist.github.com/dstogov/fba2cc621ef121826efe
>
> It's huge, but actually, only changes in zend_compile.h are matter. The rest
> is obvious renaming.
>
> the main idea - the smaller the zend_op structure, the lees memory traffic
> is required to load VM instructions during execution. The patch reduces the
> size of each opcode from 48 to 32 bytes (saves 16 bytes for each opcode, and
> applications use thousands of opoceds). This reduced the number of CPU cache
> misses by 12% and improved performance of real-life apps by 1-2%.
>
> The patch affects how constants and jump targets are represented in VM
> during execution. Previously they were implemented as absolute 64-bit
> pointers. Now they are relative 32-bit offsets.
>
> In run-time constant now should be accessed as:
> RT_CONSTANT(op_array, opine->op1) instead of opline->op1.zv
> EX_CONSTANT(opline->op1) instead of opline->op1.zv
>
> Jump targets:
> OP_JMP_ADDR(opline, opline->op2) instead of opline->op2.jmp_addr
>
> The patch doesn't change zend_op representation for 32-bit systems. They
> still use absolute addresses. The compile-time representation is also kept
> the same.
>
> The patch must affect xdebug and may be other very engine depended
> extensions, but it must not be a big problem to fix them (only ext/opcache,
> ext/reflection and sapi/phpdbg required minor changes).
>
> If nobody objects, I'm going to commit this.
As I already participated in this patch, I have no problems & objections.
thanks
>
> Thanks. Dmitry.
>
--
Xinchen Hui
@Laruence
http://www.laruence.com/