Hmm, well I take your point (and I had tested with $val=1 - see original post), but nevertheless it strikes me as damning with faint praise ;)

What you're basically saying is that labels can be faster than multiple ifs provided you have enough conditions and you make them slow enough (e.g. regex)

Given that multiple ifs are a pretty stoopid thing to do (I only used them in my benchmark for comparison purposes), this is hardly a glowing recommendation for labels.

BTW I rewrote my test script to use $ARGV[0] for $val, and ran it with val=1 and val=4 for both versions (== and =~). Here are the results (which confirm your observation) 9kb gif of graph

Tom Melly, tom@tomandlu.co.uk

In reply to Re: Re: A Luser's Benchmarking Tale by Melly
in thread A Luser's Benchmarking Tale by Melly

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.