# [RFC] Native TLS for globals in ZTS

- Thread: https://externals.io/message/40075
- Original archive: https://news-web.php.net/php.internals/40075
- Started by Arnaud Le Blanc on 2008-08-24T16:37:09+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #40075 — Arnaud Le Blanc — 2008-08-24T16:37:09+00:00

URL: https://externals.io/message/40075#40075

Hi,

I have written a RFC about my patch at http://wiki.php.net/rfc/tls

The goal of this patch is to reduce the performance overhead of ZTS builds.

Since the initial patch I made more research on various implementations of 
TLS: Linux, FreeBSD, Solaris, Windows. Based on what I found I wrote a new 
patch to avoid the problems of the initial one and the results on bench.php 
are as follows:


non-ZTS 
                         3.7s


ZTS unpatched 
                   5.2s


ZTS-patched, native TLS disabled 
5.0s


ZTS-patched, native TLS enabled 
 4.2s


Regards,

Arnaud

---

## #40093 — Arnaud Le Blanc — 2008-08-26T14:14:12+00:00

URL: https://externals.io/message/40075#40093 · In reply to: #40075

Hi,

I updated the RFC.

I added benchmark tests on x86_64: Position independent code is the default 
there and is as fast as non-PIC on IA-32. The initial patch using dynamic TLS 
gives the same results as on IA-32 with static TLS.

I also tested the patch (with a few changes) on Windows Server 2008 with IIS 
(older Windows cannot use TLS in LoadLibrary()-loaded DLLs). This works as 
expected, but there are still some restrictions.

Regards,

Arnaud


On Sunday 24 August 2008 18:37:09 Arnaud Le Blanc wrote:
> Hi,
> 
> I have written a RFC about my patch at http://wiki.php.net/rfc/tls
> 
> The goal of this patch is to reduce the performance overhead of ZTS builds.
> 
> Since the initial patch I made more research on various implementations of 
> TLS: Linux, FreeBSD, Solaris, Windows. Based on what I found I wrote a new 
> patch to avoid the problems of the initial one and the results on bench.php 
> are as follows:
> 
> 
> non-ZTS 
>                          3.7s
> 
> 
> ZTS unpatched 
>                    5.2s
> 
> 
> ZTS-patched, native TLS disabled 
> 5.0s
> 
> 
> ZTS-patched, native TLS enabled 
>  4.2s
> 
> 
> Regards,
> 
> Arnaud
