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


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to