Aha!
Moving the glob out of the loops (using Ambrus's code) gave the expected results:
/etc/ contains 311 files
Benchmark: running Ordinary, Schwartzian, Strange for at least 5 CPU s
+econds...
Ordinary: 5 wallclock secs ( 1.47 usr + 4.09 sys = 5.56 CPU) @ 99
+.28/s (n=552)
Schwartzian: 5 wallclock secs ( 3.95 usr + 1.13 sys = 5.08 CPU) @ 3
+33.46/s (n=1694)
Strange: 5 wallclock secs ( 4.01 usr + 1.12 sys = 5.13 CPU) @ 35
+9.06/s (n=1842)
/bin/ contains 111 files
Benchmark: running Ordinary, Schwartzian, Strange for at least 5 CPU s
+econds...
Ordinary: 5 wallclock secs ( 1.30 usr + 3.98 sys = 5.28 CPU) @ 34
+8.86/s (n=1842)
Schwartzian: 6 wallclock secs ( 3.97 usr + 1.45 sys = 5.42 CPU) @ 9
+79.89/s (n=5311)
Strange: 5 wallclock secs ( 3.84 usr + 1.46 sys = 5.30 CPU) @ 11
+45.85/s (n=6073)
One thing, If I used "/usr/bin" or any other path with a '/' in the middle it went haywire.
Thanks a lot for all the help everybody!
-
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.
|