Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69960 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96438 invoked from network); 30 Oct 2013 02:25:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Oct 2013 02:25:36 -0000 Authentication-Results: pb1.pair.com header.from=ab@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ab@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.73.107 as permitted sender) X-PHP-List-Original-Sender: ab@php.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:47741] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/CB-22922-C1E60725 for ; Tue, 29 Oct 2013 21:25:35 -0500 Received: by h1123647.serverkompetenz.net (Postfix, from userid 1006) id 9346823D60E2; Wed, 30 Oct 2013 03:25:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on h1123647.serverkompetenz.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.5 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable version=3.3.2 Received: from [192.168.178.7] (dslb-178-007-121-182.pools.arcor-ip.net [178.7.121.182]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by h1123647.serverkompetenz.net (Postfix) with ESMTPSA id 39C1D23D60E0; Wed, 30 Oct 2013 03:25:27 +0100 (CET) To: Dmitry Stogov Cc: Pierre Joye , PHP Internals , Andi Gutmans , Zeev Suraski , Xinchen Hui In-Reply-To: References: <63d89379efdd7f2ba0bcf0b62d5025af.squirrel@webmail.klapt.com> <7c830ad80d33e82eb5f1553d03a44c6d.squirrel@webmail.klapt.com> Content-Type: text/plain; charset="UTF-8" Date: Wed, 30 Oct 2013 03:25:23 +0100 Message-ID: <1383099923.15492.36.camel@ghost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Fix for bug #50333 From: ab@php.net (Anatol Belski) 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