Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Your influences are misleading you. The savings would be so minimal.... Let's put it to the test.
use strict; use warnings; use Benchmark qw( cmpthese ); use constant TRUE => 1 == 1; use constant FALSE => 1 == 0; sub old_foo { return 0; } sub new_foo { return; } cmpthese(-3, { old_foo => 'old_foo(); 1', new_foo => 'new_foo(); 1', }); sub old_bar { return 1; } sub new_bar { return TRUE; } cmpthese(-3, { old_bar => 'old_bar(); 1', new_bar => 'new_bar(); 1', });

The results fluctuated too much. Sometimes one is 20% faster than the other, sometimes it's the other way around. In other words, they are both so fast that the time they take is actually dependent on external factors.

By the way, new_foo isn't even equivalent to old_foo.


In reply to Re: Not returning scalars(SV) to optimize and save memory? by ikegami
in thread Not returning scalars(SV) to optimize and save memory? by Withigo

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others romping around the Monastery: (6)
    As of 2017-11-19 13:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:













      Results (281 votes). Check out past polls.

      Notices?