perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Elizabeth Mattijsen <>
Subject Re: ithreads with modperl
Date Fri, 09 Jan 2004 20:34:38 GMT
At 15:17 -0500 1/9/04, Perrin Harkins wrote:
>On Fri, 2004-01-09 at 14:52, Stas Bekman wrote:
>>  We really need more real world benchmarks to make a good judgement. It's
>>  probably quite certain that the performance is going to be worse 
>>if you spawn
>>  threads, but don't deploy the benefits available exclusively to threads
>  > (shared opcode tree, shared vars, etc).
>That reminds me, does anyone know what happened with the shared opcode
>tree?  Does it not work, or is it just dwarfed by the size of the
>non-shared stuff?  The size problems these guys are having seem to point
>to little or no sharing happening between threads.

I'm sure you know my PerlMonks article "Things yuu need to know 
before programming Perl ithreads" ( ).

I recently ran a little test that showed (at least to Devel::Size) 
that you have _at least_ about 250Kbyte of "data" that needs to be 
copied between threads if you _only_ do:

   use threads;
   use threads::shared;

And I'm not sure whether this number isn't too low, because I don't 
know for sure whether the CV's in the stash haven't been counted 
correctly.  If they were not, then you would come at about 400Kbyte 
of "data" for a _bare_ thread.

Loading a few modules, each with their initializations, add up _very_ 
quickly to several Mbytes of "data" that needs to be cloned _every_ 
time you start a thread.  And these are _not_ simple copies: all of 
the stashes need to be walked to make sure that all the [SAHC]V's are 
properly copied to the  thread's copy.  So it's taking a _lot_ of CPU 
as well...

So yes, in general I think you can say that the data copied for each 
thread, quickly dwarves whatever optrees are shared.


Reporting bugs:
Mail list info:

View raw message