On Fri, Oct 06, 2006 at 03:07:42PM +0100, Nicholas Clark wrote:
> On Fri, Oct 06, 2006 at 06:46:20AM -0700, Jerry Hedden wrote:

> > Results:
> >           Rate  str  tid
> >     str 56.5/s   -- -83%
> >     tid  340/s 502%   --
> 
> 
> The results are completely counterintuitive.
> 
> I too expected that the builtin C code for generating
> threads=SCALAR(0x1817fa0) would be faster than going through the overloading
> code in Perl_call_amagic, and then that kicking off a nested call to another
> routine (which happens to be XS)
> 
> What's actually happening is that because threads objects already have some
> overloading, then for this stringification of a reference,
> Perl_call_amagic gets called *anyway*.

> We make a message. Only it's never getting used. But we went to all the
> effort.
> 
> It will be a SMOP this evening to get rid of creating that message
> needlessly. Which might change the benchmark results. Unless anyone wishes
> to beat me to it.

That takes the benchmark differential to this for a build with -g and
-DDEBUGGING:

     Rate  str  tid
str 275/s   -- -29%
tid 385/s  40%   --

and this with -O2

      Rate  str  tid
str  500/s   -- -50%
tid 1009/s 102%   --

So the overloading code is still slowing things down for non-overloaded
stringification, but not as badly.

Nicholas Clark

Reply via email to