Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This is probably due to inefficient stringification of the object reference. Maybe the stringified value should be put into the PV portion and POK should be set on while doing Perl_sv_2pv_flags ?

I think this evaluation is spot on. If you change the inside-out implementation to something that avoids stringification:

package Class_Inside_Out; use Scalar::Util qw(refaddr); my %name; my %colour; my %age; sub new { my $key = bless \(my $dummy) => shift; $$key = refaddr ( $key ); my %args = @_; $name {$$key} = $args {name} || "abigail"; $colour {$$key} = $args {colour} || "pink"; $age {$$key} = $args {age} || 100; $key; } sub name { my $key = shift; $name {$$key} = shift if @_; $name {$$key}; } sub colour { my $key = shift; $colour {$$key} = shift if @_; $colour {$$key}; } sub age { my $key = shift; $age {$$key} = shift if @_; $age {$$key}; } sub format { my $key = shift; join " " => $name {$$key}, $colour {$$key}, $age {$$key}; }

You get something much more reasonable:

Rate closure inside_out traditional closure 177/s -- -43% -45% inside_out 313/s 76% -- -3% traditional 321/s 81% 3% --

In reply to Re^3: May Thy Closures Be Blessed by adrianh
in thread May Thy Closures Be Blessed by hardburn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-07-07 10:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?