Newsgroups: php.cvs,php.internals Path: news.php.net Xref: news.php.net php.cvs:82266 php.internals:77919 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6524 invoked from network); 13 Oct 2014 13:38:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Oct 2014 13:38:47 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.177 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.177 mail-vc0-f177.google.com Received: from [209.85.220.177] ([209.85.220.177:58735] helo=mail-vc0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/71-32936-6E5DB345 for ; Mon, 13 Oct 2014 09:38:47 -0400 Received: by mail-vc0-f177.google.com with SMTP id hq11so5766230vcb.36 for ; Mon, 13 Oct 2014 06:38:44 -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=8Xvvp9jaABmyF4RZncJ6Ehaqfu+r9rhd1xGrt9igTqk=; b=gzkVMIwVk92/bber1+Lf74FWZJBDKNFwMzSbWdv/gCrc/AN95EU/Ry1Xk+94k+lQX2 yfJD2ghnKtYqxvBbPaVPylAK4vy6nqJPtBvAcI+K0VlQQAZltzp8B+VDq3PfVtQEjGQs 8h5Wr2TA24p9bTGIeQe75MZ8l5HMgKC2SH4b9n7wRP0aCOvM8oKDPgAp/sjamvuMVZcj 92N61hSW3dgv1PVdkBCRDLPlcsRIQzvNKPakddvpyW1jAP+/IprsYM5FbGbNU2aJL8HB 6WqWtZeN5RAM3Vzm6qN4FGyHf+yG5+F48K/GhN2cuqIa3EXQo8kNWnNRaQJPok7VG6rk 6DRA== X-Gm-Message-State: ALoCoQnJ4qfEMdXKbxdp1c/5NCUwfhr7l2J6SRaNFxehpxdrxC1tmjieK131V5jd1XwTX89r0i3iTt+5vUFHYj+mL59qfUYHD08SSTnmP0viqzTwP9RE6F0rjE+Je6KBPqtSTTg6hN/T1Ztht/VmlDOElyAEhE7Jdw== MIME-Version: 1.0 X-Received: by 10.220.183.70 with SMTP id cf6mr717237vcb.80.1413207524238; Mon, 13 Oct 2014 06:38:44 -0700 (PDT) Received: by 10.52.4.41 with HTTP; Mon, 13 Oct 2014 06:38:44 -0700 (PDT) In-Reply-To: <053301cfe6e2$dd954b60$98bfe220$@belski.net> References: <35865ab5a49aa7711727174e173d0723.squirrel@webmail.klapt.com> <57df99a6abdfeeb9036b529fb83175bd.squirrel@webmail.klapt.com> <3c0bcdbb4dcfbae062ad017e15b27db5.squirrel@webmail.klapt.com> <9aee6cbba7b350fc9cce8287d32c1a3c.squirrel@webmail.klapt.com> <053301cfe6e2$dd954b60$98bfe220$@belski.net> Date: Mon, 13 Oct 2014 17:38:44 +0400 Message-ID: To: Anatol Belski Cc: Joe Watkins , Anatol Belski , Nikita Popov , "php-cvs@lists.php.net" , PHP Internals , Pierre Joye , Xinchen Hui Content-Type: multipart/alternative; boundary=089e0149cb807a175105054e0455 Subject: Re: [PHP-DEV] Re: [PHP-CVS] com php-src: fix CG(empty_string) init in ZTS: Zend/zend.c From: dmitry@zend.com (Dmitry Stogov) --089e0149cb807a175105054e0455 Content-Type: text/plain; charset=UTF-8 bench.php should be faster as well. It must be slower because of not lucky code locality or something like that. Thanks. Dmitry. On Mon, Oct 13, 2014 at 4:40 PM, wrote: > Hi Dmitry, > > thanks for taking a look, > > On Mon, October 13, 2014 13:38, Dmitry Stogov wrote: > > Hi Anatol, > > > > > > At first, I still saw the same big difference on Linux. > > bench.php ZTS - 1.340 sec, native TLS - 1.785 sec. As I understood, it > must > > be related to incomplete changes in build scripts, related to > > ZEND_ENABLE_STATIC_TSRMLS_CACHE. Right? > > > Huh, not sure why the diff you get is so big. I guess it might be so with a > full build. The bench results I was sending previously was done with > --disable-all (actually more than that isn't needed for bench.php) on > opensuse/x64. I have to check this. ZEND_ENABLE_STATIC_TSRMLS_CACHE > conversions isn't complete, that's true. > > > If I get it properly, main PHP binary should be compiled with > > -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 and shared extensions without it. It > > should lead to quite fast code in main PHP binary and statically linked > > extensions, but to slow code in shared extensions. Right? > > > With a small addition it is right. Actually any ext can possibly be > compiled with -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, just in accordance with > the following > > - ext is static, then its SOMEEXT_G should just use ZEND_TSRMG instead of > TSRMG > - ext is shared, then the ext should > - ZEND_TSRMG > - use ZEND_TSRMLS_CACHE_DEFINE > - and ZEND_TSRMLS_CACHE_UPDATE at a proper place (globals ctor is a > good one, maybe there's a better one) > - and possibly it can ZEND_TSRMLS_CACHE_EXTERN in some header to > spread over multiple c files within the same ext > > - ext can be either/or static/shared, then at compile time it need to > catch both cases. I made an exemplary conversion for ext/sockets. It can > already switch to ZEND_TSRM which will use static or function call model > to fetch TSRMLS, but it has to use COMPILE_DL_SOMEEXT && ZTS to check if > it's a separate module (so it has to update it's local TSRMLS itself). > - without -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 and steps above - an ext > will always use TSRMG (so tsrm_get_ls_cache()) to fetch globals, but the > good on that is - nothing will have to be touched and it'll work even if > slower > > > > I built PHP in this way with all extensions linked statically. Now, I see > > small slowdown on bench.php (however according to callgrind it executes > > less instructions and should be faster). Wordpress became 2% faster. > > > > So the patch becomes interesting. :) > > However, many distributions prefer shard extensions, and it would be > great > > to invent some trick to make them fast too. > So you could test it even more, but WP being faster with the current state > is a bit surprising. But well :) Probably I gonna continue with some more > conversions for the remaining exts and SAPIs, will also try to figure out > why it could be possibly slower with bench.php, and then come back again. > > > > I would also prefer to keep the semantic patch small and don't delete all > > FETCH_TSRM() in thousand places (at this point). > > Replacing macro in one place must be easier. > > It's not a problem to remove them on second step if the PoC would really > > work. > > > I think one can apply a partial reverse patch for now, then all those > places should be back. Probably easier than looking for all the > corresponding commits. So I'll do it. > > Regards > > Anatol > > > > > --089e0149cb807a175105054e0455--