Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91781 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47583 invoked from network); 19 Mar 2016 20:40:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2016 20:40:15 -0000 X-Host-Fingerprint: 94.10.73.146 unknown Received: from [94.10.73.146] ([94.10.73.146:7093] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/0B-03097-E29BDE65 for ; Sat, 19 Mar 2016 15:40:14 -0500 Message-ID: <44.0B.03097.E29BDE65@pb1.pair.com> To: internals@lists.php.net References: Date: Sat, 19 Mar 2016 20:40:09 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 94.10.73.146 Subject: Re: [PHP-DEV] Object getter method optimization From: ajf@ajf.me (Andrea Faulds) Hi Lin, Lin Yo-An wrote: > Since the original approach doesn't work, here comes another new idea: > > When executing method call on an object, if we found the method body are > just 2 op codes (FETCH_OBJ_R and RETURN), we then denote the method is a > "getter method" > > And the next time, when we execute the same method, we found the "getter > method" flag, we simply execute FETCH_OBJ_R on that object and return the > value to avoid extra op code execution time. > > Do you think if this could work? For a while I'd also been wondering if we could implement some implementation along these lines. Another approach could be possibly replacing such methods with an C implementation (though I don't know if non-internal classes can have internal methods). I don't know how successful it will be, but I'm interested to hear how much improvement it gives if you get it working. Thanks! -- Andrea Faulds https://ajf.me/