Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49082 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75491 invoked from network); 15 Jul 2010 22:19:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2010 22:19:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=felipensp@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=felipensp@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: felipensp@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:46958] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/64-47603-F598F3C4 for ; Thu, 15 Jul 2010 18:19:12 -0400 Received: by eyh6 with SMTP id 6so348490eyh.29 for ; Thu, 15 Jul 2010 15:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=zH27UvpUwd21fjJWx1rY5ixNjFGq8NlhZzFagDFzEUQ=; b=VsqhGmrd9BNyk8xlywUWKzgS6WcFkzWML/s0QQjAE3MTdAkWPC/DeyyMtXKtxbRfrX a1jnkJbcJMgPfKN6MhttPKgpM3OJFkkN9cOkDcvp/pcUJ/U9dVf3yMzc5CZ5kGwfe3NP DOncMyPKEmxeLv4mzH9yeqORV2fx09RfwGM38= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=MbTwcN/vcQNjEtkMKaPF9AAGFWClKBigMsnn+BUMyB4tuX4h2loU1/+d4fWqLLrmm9 5mIzTZ4YAKrhoEs5WF+5Ky7twuRmPsiJXs4ptjbqIPNoVusJhrM8P2xXDQ/L8ub4hjKY NWnEWF8QR58LYzxW9hM7kleH+LBaBxgs8Y+4o= MIME-Version: 1.0 Received: by 10.213.33.135 with SMTP id h7mr3514304ebd.56.1279232314429; Thu, 15 Jul 2010 15:18:34 -0700 (PDT) Received: by 10.213.108.136 with HTTP; Thu, 15 Jul 2010 15:18:34 -0700 (PDT) In-Reply-To: <4C3ED076.5060605@zend.com> References: <4C3ED076.5060605@zend.com> Date: Thu, 15 Jul 2010 19:18:34 -0300 Message-ID: To: Dmitry Stogov Cc: PHP Internals , Zeev Suraski Content-Type: multipart/alternative; boundary=0015174c437cafd04b048b747bf1 Subject: Re: [PHP-DEV] [PATCH] string_offset access optimization From: felipensp@gmail.com (Felipe Pena) --0015174c437cafd04b048b747bf1 Content-Type: text/plain; charset=UTF-8 Hi Dmitry, 2010/7/15 Dmitry Stogov > Hi, > > Recently I noticed that reading of string offset is performed in two steps. > At first special string_offset variant of temporary_variable is created in > zend_fetch_dimension_address_read() and then the real string value is > created in _get_zval_ptr_var_string_offset(). > > I think we can create the real string in the first place. This makes 50% > speed-up on string offset reading operation and allows to eliminate some > checks and conditional brunches in VM. > > The patch is attached (don't forget to regenerate zend_vm_execute.h to test > it). However it changes behavior in one bogus case. > The following code now will emit "b" (currently it generates a fatal error > - cannot use string offset as an array). > > $str = "abs"; > var_dumo($str[1][0]); > > I think it's not a problem at all. > "b" makes sense because "abs"[1] -> "b" and "b"[0] -> "b". > > I'm going to commit the patch in case of no objections. > > Thanks. Dmitry. > > The patch looks good, I did some tests, not found anything strange. Good simplyfication! :) -- Regards, Felipe Pena --0015174c437cafd04b048b747bf1--