Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42258 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78978 invoked from network); 14 Dec 2008 19:59:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Dec 2008 19:59:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.132.244 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.132.244 an-out-0708.google.com Received: from [209.85.132.244] ([209.85.132.244:50920] helo=an-out-0708.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/90-09557-DA565494 for ; Sun, 14 Dec 2008 14:59:42 -0500 Received: by an-out-0708.google.com with SMTP id b2so952858ana.38 for ; Sun, 14 Dec 2008 11:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=f1GHimf8308w1QtXsONTW5pyBuPaAi1t2Zb1K0+F0Nc=; b=cB5LIa9DgGfeZZ4c3mBz5JBkuPXdFJm3hybtpz753BC0hUlbwkJ3Q1bJ0tIipxcvSl SuF1P95pHkhODUEnfEkpXitzTLlKIIHLuhTfcJ1viFVE2KFylsS84oyxToD7mXPanDSL xL7oUmqr5qz258UghoxFBUKBCDSX4wLvifyTc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=gCNs73JlNPipHaxNlQ+HgRKs91PWa0EUHcMzsxN+oW62GLigU+QebSxkeWWWB8EYu2 8p/piost19Py29k0ANEvaP/Xt5Jo31HvgCmY9HtqnXauyf1JR7nUGyMkhVrlCSfdbiug 5tHK1TuzFDnSZsr0tsAS+813XBrG4xoM5eUmQ= Received: by 10.100.106.12 with SMTP id e12mr4118857anc.18.1229284778776; Sun, 14 Dec 2008 11:59:38 -0800 (PST) Received: by 10.100.93.10 with HTTP; Sun, 14 Dec 2008 11:59:38 -0800 (PST) Message-ID: Date: Sun, 14 Dec 2008 22:59:38 +0300 To: "David Grudl" Cc: "PHP internals" In-Reply-To: <49453D0F.6030405@grudl.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <49453D0F.6030405@grudl.com> Subject: Re: [PHP-DEV] Ternary operator optimization tip From: indeyets@gmail.com ("Alexey Zakhlestin") On Sun, Dec 14, 2008 at 8:06 PM, David Grudl wrote: > Hello, > > ternary operator is very nice syntactic sugar... > > $foo = $cond ? $bar : $baz; > > ...but it may slows down scripts. When $bar is array or relative big string, > it is better to aviod sugar and use if: > > if ($cond) $foo = $bar; else $foo = $baz; > > and reference counting will be used. > > I don't know how difficult it is to implement, but it can be very useful > speed optimization for PHP 5.3 to improve ternary operator to use reference > counting. Do you have any numbers? -- Alexey Zakhlestin http://www.milkfarmsoft.com/