Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

/o can still be useful from time to time. Firstly, you occasionally expect that the interpolated variable may change but still want to use the original value (but this is rare). Secondly, the "recompile only if changed" logic requires checking whether the pattern has changed, which takes time:

perl -MBenchmark -w ($s, $t) = qw/ foo xfoox /; timethese(-1, { oful => q{ $t =~ /$s/o }, oless => q{ $t =~ /$s/ }, }) __END__ Benchmark: running oful, oless for at least 1 CPU seconds... oful: 2 wallclock secs ( 1.08 usr + 0.00 sys = 1.08 CPU) @ +2427258.33/s (n=2621439) oless: 2 wallclock secs ( 1.15 usr + 0.00 sys = 1.15 CPU) @ +1841144.35/s (n=2117316)

Hugo

In reply to Re^3: Compiling Regular Expressions by hv
in thread Compiling Regular Expressions by Anonymous Monk

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



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

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-26 05:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found