Newsgroups: php.cvs,php.internals Path: news.php.net Xref: news.php.net php.cvs:82110 php.internals:77786 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41427 invoked from network); 5 Oct 2014 19:32:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Oct 2014 19:32:09 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:37554] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/10-39677-6BC91345 for ; Sun, 05 Oct 2014 15:32:07 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 33) id 13DDB6D209D; Sun, 5 Oct 2014 21:32:01 +0200 (CEST) Received: from 93.205.105.218 (SquirrelMail authenticated user anatol@belski.net) by webmail.klapt.com with HTTP; Sun, 5 Oct 2014 21:32:01 +0200 Message-ID: <9aee6cbba7b350fc9cce8287d32c1a3c.squirrel@webmail.klapt.com> In-Reply-To: References: <35865ab5a49aa7711727174e173d0723.squirrel@webmail.klapt.com> <57df99a6abdfeeb9036b529fb83175bd.squirrel@webmail.klapt.com> <3c0bcdbb4dcfbae062ad017e15b27db5.squirrel@webmail.klapt.com> Date: Sun, 5 Oct 2014 21:32:01 +0200 To: "Dmitry Stogov" Cc: "Anatol Belski" , "Joe Watkins" , "Anatol Belski" , "Nikita Popov" , "php-cvs@lists.php.net" , "PHP Internals" , "Pierre Joye" , "Xinchen Hui" User-Agent: SquirrelMail/1.5.2 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [PHP-CVS] com php-src: fix CG(empty_string) init in ZTS: Zend/zend.c From: anatol.php@belski.net ("Anatol Belski") Hi Dmitry, On Wed, October 1, 2014 08:01, Dmitry Stogov wrote: > Hi Anatol, > > > I know, TSRM uses TLS APIs internally. > > > In my opinion, the simplest (and probably efficient) way to get rid of > TSRMLS_DC arguments and TSRMLS_FETCH calls, would be introducing a global > thread specific variable. > > __thread void ***tsrm_ls; > > > As I understood it won't work on Windows anyway, because windows linker > is not smart enough to use TLS variables across different DLLs. May be it's > possible to have a local thread specific copy of tsrm_ls for each DLL, but > then we should make them to be consistent... > > Sorry, I can't give you any advice, and can't spend a lot of time on this > topic. > > May be description of TLS internals on ELF systems would give you some > ideas. > > http://www.akkadia.org/drepper/tls.pdf > > > Thanks. Dmitry. > > I've reworked this patch to take a pointer per one shared unit. Please see here http://git.php.net/?p=php-src.git;a=commitdiff;h=76081df168829a5cc0409fac47c217d4927ec6f6 (though this was just the first in the series). Afterwards I've adapted ext/standard and also converted ext/sockets as an exemplary item because it's usually compiled shared. With this change I experience much better performance - a diff is in 100-50ms range compared to the master TS build. Particular positions in bench.php show even some better result. However this is not a global __thread variable, but a local one to every shared unit. Say tsrm_ls will have to be declared in every so, dll or exe and updated on request. For now I've put the update code in MINIT and into the first ctor (zmm is the one in the php7ts.dll) called. The ctor seems to be the only reliable place (but maybe I'm wrong), despite it'll be called for every request instead of per thread, that won't be very bad. I'd suggest to go this way so we have the same flow everywhere. Regards Anatol