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

[email protected] (Nicholas Clark)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On Tue, Jun 15, 2010 at 10:40:38PM +0200, Nicholas Clark wrote:
> In perl.git, the branch blead has been updated
> 
> <http://perl5.git.perl.org/perl.git/commitdiff/0cb20dae370512c655eb665a7d5089db2819e862?hp=0a18a49b281a5a76e75de77e45ee27ad1b807bb2>
> 
> - Log -----------------------------------------------------------------
> commit 0cb20dae370512c655eb665a7d5089db2819e862
> Author: Nicholas Clark <[email protected]>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.