develooper Front page | perl.perl5.porters | Postings from June 2010

Re: [perl.git] branch blead, updated. v5.13.1-198-g0cb20da

Nicholas Clark
June 15, 2010 13:45
Re: [perl.git] branch blead, updated. v5.13.1-198-g0cb20da
Message ID:
On Tue, Jun 15, 2010 at 10:40:38PM +0200, Nicholas Clark wrote:
> In perl.git, the branch blead has been updated
> <>
> - Log -----------------------------------------------------------------
> commit 0cb20dae370512c655eb665a7d5089db2819e862
> Author: Nicholas Clark <>
> Date:   Tue Jun 15 21:26:14 2010 +0100
>     In Perl_safesys{c,m,re}alloc(), defer dTHX for non-DEBUGING builds.
>     Under ithreads, dTHX expands to pthread_getspecific() [or something similarly
>     expensive], which the compiler can't optimise away. However, its return value
>     isn't needed unless the allocation fails. So defer the call, hence avoiding
>     it entirely on a successful allocation.
>     DEBUGING builds require the value of dTHX for debugging purposes, so we can't
>     postpone it for them. Unthreaded builds were never affected as they don't use
>     thread local storage for the interpreter context.

This avoids a pthread_getspecific() on *every* malloc()/realloc()/calloc()
under (normal) ithreads, for the success path.

Not sure how much of a speedup that will give, but it has to be a step in the
right direction. (Not sure how to measure it, and wasn't actually proposing to
put huge effort into it).

Other than Mandriva, does every OS distribution ship a threaded perl?

Nicholas Clark Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About