Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67974 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99427 invoked from network); 27 Jun 2013 16:54:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2013 16:54:56 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.41 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.212.41 mail-vb0-f41.google.com Received: from [209.85.212.41] ([209.85.212.41:53907] helo=mail-vb0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/BD-34034-C5E6CC15 for ; Thu, 27 Jun 2013 12:54:55 -0400 Received: by mail-vb0-f41.google.com with SMTP id p13so873255vbe.28 for ; Thu, 27 Jun 2013 09:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=bqdYGb98rNBJKZevmHndJH3g+WYquUPt8f6XsrigoyA=; b=MnZKRvn4g58J2qSETHQMeZ82T0a+fpj6exnpgHOkAEoRStzkFdX2tPLaRSH/A6WCJM WQWkb2z0luLHvdxzMCFXdZEaBXvioo+f1o3fTQ8HKtVBTKYz5yCIeJtIsF6RFmE6Zafr +qdf1C13Dag+xaC35mYysAZc3qhul5CV/XDz9Kiw4kFEgbCHplxXiB2cdOG+mPxV7GYf VWvsCIatqJoRSfQdIRuZzV9sGQ8H4ZYidZQKRZlKvVVUxCO5HSDuoDvSDxu1grQefQFg lqEkcrZzB3PkhvvMRu3iumSpgGSciJnwayo9B9Mp0saGJyBi0sMhrUrBqwlrt4tLfjrm hCYQ== MIME-Version: 1.0 X-Received: by 10.52.33.47 with SMTP id o15mr3296611vdi.1.1372352090185; Thu, 27 Jun 2013 09:54:50 -0700 (PDT) Received: by 10.58.94.201 with HTTP; Thu, 27 Jun 2013 09:54:50 -0700 (PDT) In-Reply-To: References: <51C9FA9C.8050403@sugarcrm.com> <51CA1C93.6080500@sugarcrm.com> <51CA24C5.9090505@sugarcrm.com> <51CB167A.4020207@sugarcrm.com> Date: Thu, 27 Jun 2013 12:54:50 -0400 Message-ID: To: Laruence Cc: Stas Malyshev , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=20cf307ca184d7acef04e0259e19 Subject: Re: [PHP-DEV] RFC: Protocol Type Hinting From: ircmaxell@gmail.com (Anthony Ferrara) --20cf307ca184d7acef04e0259e19 Content-Type: text/plain; charset=ISO-8859-1 Laruence, previous test script only measure the last all, although that, > interface already won with complex arguments signatures... > > here is a fixed one: https://gist.github.com/laruence/5877928 > > run 3 times: > > $ sapi/cli/php /tmp/2.php > Interface in 1.7314801216125 seconds, 1.7314801216125E-6 seconds per run > Structural in 1.7587349414825 seconds, 1.7587349414825E-6 seconds per run > Native in 1.0431759357452 seconds, 1.0431759357452E-6 seconds per run > [Laruence@localhost:/Users/Laruence/opensource/trunk/] > $ sapi/cli/php /tmp/2.php > Interface in 1.7132070064545 seconds, 1.7132070064545E-6 seconds per run > Structural in 1.7542362213135 seconds, 1.7542362213135E-6 seconds per run > Native in 1.0379688739777 seconds, 1.0379688739777E-6 seconds per run > [Laruence@localhost:/Users/Laruence/opensource/trunk/] > $ sapi/cli/php /tmp/2.php > Interface in 1.6947190761566 seconds, 1.6947190761566E-6 seconds per run > Structural in 1.7611300945282 seconds, 1.7611300945282E-6 seconds per run > Native in 1.04856300354 seconds, 1.04856300354E-6 seconds per run > > > as you can see, still, your patch won zero ... > Your benchmark is timing *way* too much. It needs to narrow the measurement surface significantly: https://gist.github.com/ircmaxell/5878060 That measures only the dispatch time (discounting differences in object construction, etc). And when I run that: $ sapi/cli/php laruence_test.php Interface in 0.51537394523621 seconds, 1.7179131507874E-7 seconds per run Structural in 0.51391339302063 seconds, 1.7130446434021E-7 seconds per run Native in 0.31268692016602 seconds, 1.0422897338867E-7 seconds per run $ sapi/cli/php laruence_test.php Interface in 0.52541399002075 seconds, 1.7513799667358E-7 seconds per run Structural in 0.54076099395752 seconds, 1.8025366465251E-7 seconds per run Native in 0.32039928436279 seconds, 1.0679976145426E-7 seconds per run $ sapi/cli/php laruence_test.php Interface in 0.51772499084473 seconds, 1.7257499694824E-7 seconds per run Structural in 0.50954604148865 seconds, 1.6984868049622E-7 seconds per run Native in 0.31669473648071 seconds, 1.0556491216024E-7 seconds per run $ sapi/cli/php laruence_test.php Interface in 0.51783013343811 seconds, 1.7261004447937E-7 seconds per run Structural in 0.50820827484131 seconds, 1.6940275828044E-7 seconds per run Native in 0.3112211227417 seconds, 1.0374037424723E-7 seconds per run $ sapi/cli/php -v PHP 5.6.0-dev (cli) (built: Jun 27 2013 12:35:30) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.6.0-dev, Copyright (c) 1998-2013 Zend Technologies (a non-debug build, no extensions) In this case, which also ignores the compile time of interface resolving (which does add slowdown to the compile step, which a fair benchmark would take into count). But these runs show something interesting. Interfaces average mathematically to 1.730283E-7 per call. Structural hints average to 1.7270175E-7 Both are within the margin of error of the tests to prove that **at worst** they are the same speed. Which shows that unless you want to argue about literally microseconds, I think we can put this performance piece to rest... Especially that "runtime is slow" which has been brought up over and over again has been disproven... The worst case that you could make a justification for is ignoring 1/2 the interface's cost... Which is pretty silly in a holistic discussion... So can we please get past this "performance" issue, and talk about something that actually matters...? --20cf307ca184d7acef04e0259e19--