Wow, that, and using word boundaries from tye's hint, made a significant difference!
before:
Benchmark: timing 2500 iterations of grepGen, mapGen, smartGen...
grepGen: 23 wallclock secs (22.51 usr + 0.00 sys = 22.51 CPU) @ 11
+1.06/s (n=2500)
mapGen: 11 wallclock secs (11.42 usr + 0.00 sys = 11.42 CPU) @ 21
+8.93/s (n=2500)
smartGen: 1 wallclock secs ( 1.05 usr + 0.00 sys = 1.05 CPU) @ 23
+92.34/s (n=2500)
after:
Benchmark: timing 2500 iterations of grepGen, mapGen, smartGen...
grepGen: 14 wallclock secs (13.70 usr + 0.00 sys = 13.70 CPU) @ 18
+2.52/s (n=2500)
mapGen: 13 wallclock secs (13.57 usr + 0.00 sys = 13.57 CPU) @ 18
+4.20/s (n=2500)
smartGen: 2 wallclock secs ( 1.19 usr + 0.00 sys = 1.19 CPU) @ 21
+07.93/s (n=2500)
That really narrowed the gap between grep and map.
-
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.
|