Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56194 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20939 invoked from network); 9 Nov 2011 15:25:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Nov 2011 15:25:11 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.161.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.161.42 mail-fx0-f42.google.com Received: from [209.85.161.42] ([209.85.161.42:33733] helo=mail-fx0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/00-20708-F3B9ABE4 for ; Wed, 09 Nov 2011 10:24:48 -0500 Received: by faan2 with SMTP id n2so1954111faa.29 for ; Wed, 09 Nov 2011 07:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=vllx8GAz9c8O9fWf9Z2K1++4HO8AGESCVMcb2LDepcg=; b=aOhOAstYPfLrZYpDBLt5er8jbzSBwdsrwjzbBcifvrl1aLbEGKJ67NZ6/NxKKL4ogJ pOJHMpcGFtyKm9AUpf6I8nY+eidlLKAycQGr9oAx9k8KOgu0vz04p3DLaLS/XJRrkAzY xwK4B80MZnDK47yhWwKfFEweTeWy5hq7tZPSs= MIME-Version: 1.0 Received: by 10.152.103.211 with SMTP id fy19mr1797066lab.39.1320852273530; Wed, 09 Nov 2011 07:24:33 -0800 (PST) Received: by 10.152.2.70 with HTTP; Wed, 9 Nov 2011 07:24:33 -0800 (PST) In-Reply-To: References: Date: Wed, 9 Nov 2011 16:24:33 +0100 Message-ID: To: =?ISO-8859-1?Q?Miroslav_Kubel=EDk?= Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: Ternary operator performance improvements From: nikita.ppv@googlemail.com (Nikita Popov) Hi Miroslav! Yes, the ternary patch fixes that problem too :) Nikita 2011/11/9 Miroslav Kubel=EDk : > On 10/14/2011 10:08 PM, Arnaud Le Blanc wrote: >> >> Hi, >> >> I've already posted this patch and it has since been reviewed and >> improved. >> I'm re-posting it for discussion before eventually commiting it. >> >> The ternary operator always copies its second or third operand, which is >> very >> slow compared to an if/else when the operand is an array for example: ..= . > > Same "copy always" behavior is made with string in ternary operator, and > it can be > also very annoying e.g: > > $content =3D > file_get_contents('http://www.w3.org/TR/2011/WD-html-markup-20110525/spec= .html'); > $test =3D $content !=3D=3D false ? $content : ''; > > Is this case also solved with your patch or huge strings are still proble= m > with a ternary "copy always" functionality? Maybe it's more rare case the= n > array. > > P.S: Sorry I don't test it directly with beta2, I have no place to test. > > M. Kubelik > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >