Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86480 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28020 invoked from network); 3 Jun 2015 22:34:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jun 2015 22:34:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=brian@moonspot.net; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=brian@moonspot.net; sender-id=pass Received-SPF: pass (pb1.pair.com: domain moonspot.net designates 173.203.187.67 as permitted sender) X-PHP-List-Original-Sender: brian@moonspot.net X-Host-Fingerprint: 173.203.187.67 smtp67.iad3a.emailsrvr.com Linux 2.6 Received: from [173.203.187.67] ([173.203.187.67:57046] helo=smtp67.iad3a.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/60-21770-DD08F655 for ; Wed, 03 Jun 2015 18:34:08 -0400 Received: from smtp25.relay.iad3a.emailsrvr.com (localhost.localdomain [127.0.0.1]) by smtp25.relay.iad3a.emailsrvr.com (SMTP Server) with ESMTP id EE27B1801DA; Wed, 3 Jun 2015 18:34:02 -0400 (EDT) Received: by smtp25.relay.iad3a.emailsrvr.com (Authenticated sender: brian-AT-moonspot.net) with ESMTPSA id 9091A180226; Wed, 3 Jun 2015 18:34:02 -0400 (EDT) X-Sender-Id: brian@moonspot.net Received: from Adrastea.local (71-45-12-44.res.bhn.net [71.45.12.44]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.4.2); Wed, 03 Jun 2015 22:34:02 GMT Message-ID: <556F80CF.40303@moonspot.net> Date: Wed, 03 Jun 2015 17:33:51 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: bishop@php.net, PHP internals References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Method call overhead From: brian@moonspot.net (Brian Moon) On 6/2/15 22:30 , Bishop Bettini wrote: > Hi! > > I've measured the overhead for method calls in a variety of environments > (Amazon, Travis, and 3v4l). The results are reliable and here's 3v4l > . > > Some observations. First, as expected, direct calls are faster than static > object calls, which are faster than object calls. Second, in absolute > times PHP7 outperforms HHVM3 substantially. Kudos, really impressive. > > My question though is on relative times. Method call overhead is > consistently 50% to 150% over a direct call. Is my experiment invalid, or > is this overhead expected? Is the overhead in the allocation, > deallocation, GC? > > Cheers, > bishop > This is a better representation of what you are trying to show. It removes all the magic call back stuff that could be adding to the slowness you are seeing. In addition, it does not create a new object on every call for the object method. Creating a new object is going to explicitly slow things down. But, it's not related to the call time. http://3v4l.org/biM9G -- Brian. -------- http://brian.moonspot.net/