Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79523 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27509 invoked from network); 10 Dec 2014 15:27:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Dec 2014 15:27:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.181 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:54383] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/B0-09154-75668845 for ; Wed, 10 Dec 2014 10:27:21 -0500 Received: by mail-vc0-f181.google.com with SMTP id le20so1515607vcb.12 for ; Wed, 10 Dec 2014 07:27:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=FgCCSZFpq/DCxoawOkGTaKK51uYGleq8JRGhCaks6bo=; b=aQic7jMU4fA1q6jlZnxYIxOEuq8PGhWHDQHLHRLQKN4R7hRZhMYh2PeCabMs8bVkf5 1Gv5uMEQe/6HXnmFW0Ot4Rc0Bg40wtlSCxBglf8R2gwI8LpFB1/kDYBGxOfQCigtjuaH IS4WdLLeD3wURm5ymO0Xrq6IINZa67YuVRGqMkBHQowS8cjS9K7oFONDdLs2sx1Yk9X9 J4UIisGgPzsYfi8C7t/3L/djU5kC4TKz0ZLX9LZxpmrIPBvM1M/i9M7lfi7qBbopda5r N5jSBW8xhxKBNKPnPe5EfcbK6DWzcPBLJfSLBpWDMVqZzuis/1NkFazo8N/xmGP4p34F Wpnw== X-Gm-Message-State: ALoCoQk1NqeeeRzjWFbS8cdD5QJ6cwwnl6k55ycvTNPhVvFRT85SdbHnkc6nC/9sckIz00msG8zLXSvZiqZOW+lpL4i/CjhRNTNxkPLpuqY0Uy8a8gnkP/sKu2u6c66QyGIYrwd3rpbGCSloA5QMq8EaP10kOyfTFg== MIME-Version: 1.0 X-Received: by 10.220.91.78 with SMTP id l14mr3209972vcm.4.1418225236567; Wed, 10 Dec 2014 07:27:16 -0800 (PST) Received: by 10.52.176.231 with HTTP; Wed, 10 Dec 2014 07:27:16 -0800 (PST) Date: Wed, 10 Dec 2014 19:27:16 +0400 Message-ID: To: PHP Internals , Xinchen Hui , Zeev Suraski , Nikita Popov , Derick , Joe Watkins , Bob Weinand Content-Type: multipart/alternative; boundary=047d7b343e5c70033a0509de4b2f Subject: 64-bit performance improvement by reducing zend_op size. From: dmitry@zend.com (Dmitry Stogov) --047d7b343e5c70033a0509de4b2f Content-Type: text/plain; charset=UTF-8 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. Thanks. Dmitry. --047d7b343e5c70033a0509de4b2f--