Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48368 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24625 invoked from network); 21 May 2010 06:18:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 May 2010 06:18:03 -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 212.25.124.185 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.185 il-mr1.zend.com Received: from [212.25.124.185] ([212.25.124.185:36605] helo=il-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 86/7D-45208-99526FB4 for ; Fri, 21 May 2010 02:18:03 -0400 Received: from il-gw1.zend.com (unknown [10.1.1.21]) by il-mr1.zend.com (Postfix) with ESMTP id 43EE950516; Fri, 21 May 2010 08:55:11 +0300 (IDT) Received: from ws.home ([10.1.10.27]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 21 May 2010 09:17:58 +0300 Message-ID: <4BF62595.8090403@zend.com> Date: Fri, 21 May 2010 10:17:57 +0400 User-Agent: Thunderbird 2.0.0.23 (X11/20090825) MIME-Version: 1.0 To: Christopher Jones CC: PHP Internals References: <4BF24049.90408@zend.com> <4BF571F7.2000400@oracle.com> In-Reply-To: <4BF571F7.2000400@oracle.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 21 May 2010 06:17:58.0949 (UTC) FILETIME=[5BF7FD50:01CAF8AD] Subject: Re: [PHP-DEV] Run Time Cache RFC From: dmitry@zend.com (Dmitry Stogov) Hi Jones, Christopher Jones wrote: > > > Dmitry Stogov wrote: > > Hi, > > > > I'm proposing another optimisation technique implementation for PHP > > which makes up to 20% speed up on synthetic tests and up to 8% speed up > > on real-life applications. > > > > The technique is similar to "inline caches" which is very popular in JIT > > compilers for object oriented languages. > > > > http://wiki.php.net/rfc/runtimecache > > > > The patch breaks binary and source compatibility but it's not hard to > > adopt extensions to use it. > > > > I'm going to commit the patch on next week in case of no objections. > > > > Thanks. Dmitry. > > > > Hi Dmitry, > > Can update the RFC to explain the breakage and It's clear from the patch. The same is explained in RFC in human language, but it's not so exact :) Index: Zend/zend.h =================================================================== --- Zend/zend.h (revision 299422) +++ Zend/zend.h (working copy) @@ -298,6 +298,7 @@ typedef struct _zend_object { zend_class_entry *ce; HashTable *properties; + zval **properties_table; HashTable *guards; /* protects from __get/__set ... recursion */ } zend_object; @@ -468,11 +469,13 @@ zend_uint ce_flags; HashTable function_table; - HashTable default_properties; HashTable properties_info; - HashTable default_static_members; - HashTable *static_members; + zval **default_properties_table; + zval **default_static_members_table; + zval **static_members_table; HashTable constants_table; + int default_properties_count; + int default_static_members_count; const struct _zend_function_entry *builtin_functions; union _zend_function *constructor; > give the required or > suggested best-practice changes for extensions? Most affected php extensions already fixed with the same patch. It usually requires just one line change. Index: ext/dom/php_dom.c =================================================================== --- ext/dom/php_dom.c (revision 299422) +++ ext/dom/php_dom.c (working copy) @@ -1053,7 +1053,6 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool hash_copy TSRMLS_DC) /* {{{ */ { zend_class_entry *base_class; - zval *tmp; dom_object *intern; if (instanceof_function(class_type, dom_xpath_class_entry TSRMLS_CC)) { @@ -1075,7 +1074,7 @@ zend_object_std_init(&intern->std, class_type TSRMLS_CC); if (hash_copy) { - zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); + object_properties_init(&intern->std, class_type); } return intern; The complete patch is attached to RFC, and in case anyone likes to understand it, they have to look into the patch itself. Thanks. Dmitry. > Thanks, > > Chris > >