Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69965 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28752 invoked from network); 30 Oct 2013 12:00:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2013 12:00:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain zend.com from 209.85.212.174 cause and error) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.212.174 mail-wi0-f174.google.com Received: from [209.85.212.174] ([209.85.212.174:53708] helo=mail-wi0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/31-17074-EC4F0725 for ; Wed, 30 Oct 2013 07:00:16 -0500 Received: by mail-wi0-f174.google.com with SMTP id cb5so6662756wib.1 for ; Wed, 30 Oct 2013 05:00:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=X3fdzOnNJuJDnyzSHhqwP1dxkhKa7hC5DAlMelZwgZU=; b=RQ0pg+2Qsf5dH5k1H0E3tMUVcvFoN3iRLPVOrfFVMihN0/cPQ95uvMmVf3Cg2ZBRkr HF5rYTYQGJyP5+IHS5NdI8eMwhgdOhJcGHyFzbZSAcKLJfuNCbD3fwoYia3cofIMAXrY J96B0gRZ7erwcVcT/Aajp2V5y37JU1l90vbkrP/t5q2oyBzcagfaZg9Gb22mK3J0Or2d R60ZGtrBAboHK9/W4CPIuK2j8fq3GnH/eNjKOeMnwfZ7lugC0Fpw4TA6gAbN817n6Rr3 8yJd+i1tHP93ZloNdzIpA6jCXFrYuqX+tcRyPA2rnAXkXITPnqI/BIcso/cTsExDgBu4 5bPQ== X-Gm-Message-State: ALoCoQkabKdIeBteKb25DmYtwjLXBs7hOpJuy4Dyf3+778NVH1eqDIzZvOFlLooHvFTKsqiTZGgt1gC5l9EnJX1R/HcmV18TNbEjTBERqEYSxfHOLMw4c+hxZPR7uBNu229CFUsxnqGs MIME-Version: 1.0 X-Received: by 10.194.48.74 with SMTP id j10mr1811891wjn.41.1383134412373; Wed, 30 Oct 2013 05:00:12 -0700 (PDT) Received: by 10.227.214.144 with HTTP; Wed, 30 Oct 2013 05:00:12 -0700 (PDT) In-Reply-To: References: <63d89379efdd7f2ba0bcf0b62d5025af.squirrel@webmail.klapt.com> <7c830ad80d33e82eb5f1553d03a44c6d.squirrel@webmail.klapt.com> <1383099923.15492.36.camel@ghost> Date: Wed, 30 Oct 2013 16:00:12 +0400 Message-ID: To: Anatol Belski Cc: Pierre Joye , PHP Internals , Andi Gutmans , Zeev Suraski , Xinchen Hui Content-Type: multipart/alternative; boundary=047d7ba975c853a4b204e9f4138c Subject: Re: [PHP-DEV] Re: Fix for bug #50333 From: dmitry@zend.com (Dmitry Stogov) --047d7ba975c853a4b204e9f4138c Content-Type: text/plain; charset=UTF-8 Hi Anatol, I've posted few comments at https://github.com/php/php-src/pull/500/files Otherwise, the patch looks fine. I think it may be accepted even if it doesn't make visible improvement. Of course, when the small issues described in comment are fixed. There were also a minor merging conflict in ext/opcache/ZendAccelerator.c (it's not a problem at all). I hope you testd ZTS PHP with patch well, because I mainly care about non-ZTS builds. Thanks. Dmitry. On Wed, Oct 30, 2013 at 10:49 AM, Dmitry Stogov wrote: > I don't think it makes sense to invest into it right now. > Lets finish with existing patch. > > Also, alloca() allocates data on CPU stack, so such data is automatically > freed when function returns. > In case you change CWD_STATE_COPY() to use alloca(), the "state" couldn't > be returned from the function. > I'm not sure if it'll work for all use cases. > > Thanks. Dmitry. > > > On Wed, Oct 30, 2013 at 6:25 AM, Anatol Belski wrote: > >> Hi Dmitry, >> >> On Tue, 2013-10-29 at 11:45 +0400, Dmitry Stogov wrote: >> > Hi Anatol, >> > >> > >> > Thank you for update. >> > >> > I'm surprised you don't see speed difference even with ZTS :( >> > >> > >> > I didn't get what you propose to change in virtual_file_ex(). >> > >> > >> > I'll do a more careful patch review later on this week. >> > >> > >> >> the story is that >> >> - the original patch had replacements for all tsrm_do_alloca() and >> malloc() to emaloc() >> - after that, i've turned the places originally having tsrm_do_alloca() >> to do_alloca() >> >> Just as we discussed, and that's the current state of the patch. Still, >> there are many places using the e*() family of functions, like >> >> >> https://github.com/weltling/php-src/blob/bug50333/Zend/zend_virtual_cwd.c#L151 >> >> https://github.com/weltling/php-src/blob/bug50333/Zend/zend_virtual_cwd.c#L1340 >> >> Alone for that two I find 21 occurrences of each elsewhere in the file. >> As they are used very often in other filesystem functions like >> virtual_copy(), virtual_rename(), etc. That's why I thought it could >> make sense to turn any emalloc() usage into do_alloca(). But as the >> do_alloca(size, use_heap) requires that use_heap argument to determine >> the fallback situation, the signatures in at least that two cases for >> virtual_file_ex() or CWD_STATE_COPY() will need to be extended, so the >> correct freeing can happen. A simple snippet in pseudo code, just to >> illustrate the idea >> >> currently: >> >> some_function() >> { >> CWD_STATE_COPY(&new_state, &CWDG(cwd)); >> virtual_file_ex(&new_state, path, NULL, CWD_REALPATH TSRMLS_CC); >> CWD_STATE_FREE(&new_state); >> } >> >> should be like: >> >> some_function() >> { >> ALLOCA_FLAG(use_heap) >> CWD_STATE_COPY(&new_state, &CWDG(cwd), use_heap); >> virtual_file_ex(&new_state, path, NULL, CWD_REALPATH, use_heap >> TSRMLS_CC); >> CWD_STATE_FREE(&new_state, use_heap); >> } >> >> That's of course much deeper change and would affect more code outside >> just the scope of that one file, still that's manageable. I'd expect >> some more functions needing that, so then we'd have do_alloca() usage >> everywhere and drop all e*() invocations. Maybe then we see some >> effect :) >> >> Regards >> >> Anatol >> >> >> >> >> >> > --047d7ba975c853a4b204e9f4138c--