There is no difference ;)
#!/usr/bin/perl -- use strict; use warnings; use Benchmark qw' cmpthese '; BEGIN { *begin = sub {} } INIT { *init = sub {} } sub declared {} *runtime = sub {}; cmpthese(-3, { begin => sub { begin() for (1 .. 1000) }, init => sub { init() for (1 .. 1000) }, declared => sub { declared() for (1 .. 1000) }, runtime => sub { runtime() for (1 .. 1000) } }); __END__
$ perl temp.pl Rate declared init runtime begin declared 1663/s -- -0% -3% -6% init 1670/s 0% -- -3% -6% runtime 1722/s 4% 3% -- -3% begin 1772/s 7% 6% 3% -- $ perl temp.pl Rate begin init runtime declared begin 1607/s -- -1% -1% -9% init 1621/s 1% -- -1% -8% runtime 1630/s 1% 1% -- -8% declared 1770/s 10% 9% 9% -- $ perl temp.pl Rate declared runtime begin init declared 1622/s -- -2% -3% -4% runtime 1655/s 2% -- -1% -2% begin 1668/s 3% 1% -- -1% init 1686/s 4% 2% 1% -- $ perl temp.pl Rate runtime init begin declared runtime 1551/s -- -6% -7% -11% init 1658/s 7% -- -0% -5% begin 1661/s 7% 0% -- -4% declared 1737/s 12% 5% 5% --

In reply to Re: Subs created at run-time are faster than those created at compile-time by Anonymous Monk
in thread Subs created at run-time are faster than those created at compile-time by neodon

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.