Since it turns out to be stack manipulation providing the savings, the cases where I'm going to be able to take advantage of the ampersand are few and far between.
cmpthese( -1, {
k1 => sub { $foo->do_nothing(1) },
k2 => sub { Foo->do_nothing(1) },
k3 => sub { Foo::do_nothing(1) },
k4 => sub { do_nothing(1) },
k5 => sub { &do_nothing(1) },
});
Rate k2 k1 k5 k3 k4
k2 1380806/s -- -14% -34% -35% -37%
k1 1610612/s 17% -- -23% -25% -26%
k5 2103412/s 52% 31% -- -1% -4%
k3 2133262/s 54% 32% 1% -- -2%
k4 2181254/s 58% 35% 4% 2% --
-
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 How to display code and escape characters
are good places to start.
|