Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86483 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46046 invoked from network); 4 Jun 2015 04:45:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2015 04:45:03 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.46 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.218.46 mail-oi0-f46.google.com Received: from [209.85.218.46] ([209.85.218.46:34694] helo=mail-oi0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/01-32964-2C7DF655 for ; Thu, 04 Jun 2015 00:44:52 -0400 Received: by oifu123 with SMTP id u123so23305381oif.1 for ; Wed, 03 Jun 2015 21:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=n54i/kMlD3Y3B0wRTJ79hh1ffl5pB8WmtVnsYUnv5DE=; b=oX8FTmIjMksEppVySqVKKvVHR8HnIBXspSHU1RANh4DSYxoffUxWpOxiQc+SwC5IkV Q98yNoqfHM/9Gv1dYxppNOJutvlbyF4yiswzPjQOtVK6hpGFKfZRNgVnhwT7RnVcgzs0 ANZ44U07mcTshZcBH0jeuP6eEdYbH86BcmKGvoxFtbh2Dj9HBkHvt7CMstlRLBKt3s1w qIvXYo7Qvb7J1SWMwwkVQdjK4Dwe/bM1DGy9DkIKL/JjnDffgBktn27sxcIP7WOtL3ww hUtVme7XT79GvlOQZfEnSK8KZbNQXRV83d5Y6x4Jvfi/O41E4HOTKhWq4xX7kJhlCeAp d6Gw== X-Received: by 10.182.47.225 with SMTP id g1mr30459847obn.82.1433393088098; Wed, 03 Jun 2015 21:44:48 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.170.196 with HTTP; Wed, 3 Jun 2015 21:44:07 -0700 (PDT) In-Reply-To: References: <556F80CF.40303@moonspot.net> Date: Thu, 4 Jun 2015 13:44:07 +0900 X-Google-Sender-Auth: LTo2iUnipFmNRZmFbmNbi1I-5kM Message-ID: To: Brian Moon Cc: Bishop Bettini , PHP internals Content-Type: multipart/alternative; boundary=089e0158ada2d6fa960517a9d590 Subject: Re: [PHP-DEV] Method call overhead From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e0158ada2d6fa960517a9d590 Content-Type: text/plain; charset=UTF-8 On Thu, Jun 4, 2015 at 1:35 PM, Yasuo Ohgaki wrote: > On Thu, Jun 4, 2015 at 7:33 AM, Brian Moon wrote: > >> 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 >> > > This version adds up precision errors because microtime() precision is not > high enough for > the purpose. Since the error is random, it does not affect proportion much > but total > execution time. Following damn code does better job for these kinds of > benchmarks. > > http://3v4l.org/eJK07 > > See the total amount of execution time recorded. > If we really need pure execution time, then it should record "for loop" > execution time > with empty body. > One additional note. Even when "for loop" execution time is subtracted, we still have to take into the return value handling time to be precise. Since "for loop" and "return value" handling is constant time, increasing the number of iterations and ignoring the time is easier. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e0158ada2d6fa960517a9d590--