I don't get such a large difference, but then, I don't muddy the waters by using subs or by calling external programs.

No you muddy the waters other ways. :-) First off using subs or strings makes no difference to validity of the benchmark so long as everything benchmarked uses the same technique. Any difference that might result from that would be more than drowned out by noise and by the speed difference of the machines we are using to do the benchmarking.

Second, your assertion that "$& isn't as costly as it used to be" may be true, but is beside the point. The point is that it is far more efficient to not use it. Why dont you run the code I posted and show us just how much it does cost on your system? On my system it would appear that it costs a 125% slowdown. That is signifigant no matter how you approach it.

Yves / DeMerphq
---
Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)


In reply to Re: Re: Unfortunately benchmarking things with $& isn't easy... by demerphq
in thread Obtaining server name from UNC path by blackadder

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.