Nicholas Clark wrote:
> [patch 28974] and this with -O2
> 
>       Rate  str  tid
> str  500/s   -- -50%
> tid 1009/s 102%   --

Great job on this, Nick.  Thanks.

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

It's not the use of overload.pm that is still the issue.
It's just that generating the Class=TYPE(0xADDR) string
takes so much time.  Your patch puts stringification of
overloaded and non-overloaded objects nearly on a par.
However, both still pale in comparison to getting a TID:

    use strict;
    use warnings;
    no warnings 'void';

    use Benchmark qw(cmpthese);

    use threads;

    my $thr = threads->create(sub {});

    my $obj = bless(\(my $x=1), 'foo_bar');

    cmpthese( -1, {
        'obj' => sub { ''.$obj      for (1..1000) },
        'thr' => sub { ''.$thr      for (1..1000) },
        'tid' => sub { ''.$thr->tid for (1..1000) }
    });

    $thr->join();

Results:
         Rate  thr  obj  tid
    thr 131/s   --  -2% -63%
    obj 133/s   2%   -- -62%
    tid 355/s 171% 166%   --

Changing the above to "use threads 'stringify';", and
the results are:

         Rate  obj  thr  tid
    obj 133/s   -- -59% -62%
    thr 328/s 146%   --  -7%
    tid 352/s 164%   7%   --

which shows the 7% overload overhead, but also shows
that ""-overloading is so much better than C=T(0xA)
stringification.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to