I finally got off my lazy back and ran the test on my home machine, a trusty P-100 with 80 MB RAM, and here are the results (with ActivePerl 5.005_03 build 517):
FAT 16 drive (no HD activity during the second run)
t1: 17 wallclock secs ( 6.66 usr + 9.89 sys = 16.55 CPU)
t2: 16 wallclock secs ( 5.89 usr + 8.47 sys = 14.36 CPU)
t3: 41 wallclock secs (16.67 usr + 18.16 sys = 34.83 CPU)
t4: 27 wallclock secs ( 8.37 usr + 16.88 sys = 25.26 CPU)
t5: 15 wallclock secs ( 7.75 usr + 7.07 sys = 14.82 CPU)
NTFS drive (slight HD activity for the later parts of the HD)
t1: 96 wallclock secs (30.07 usr + 59.09 sys = 89.17 CPU)
t2: 87 wallclock secs (27.73 usr + 53.18 sys = 80.91 CPU)
t3: 179 wallclock secs (72.02 usr + 96.92 sys = 168.94 CPU)
t4: 142 wallclock secs (36.63 usr + 96.15 sys = 132.78 CPU)
t5: 81 wallclock secs (35.33 usr + 43.25 sys = 78.58 CPU)
So here File::Find is again on par with the solution reading any directory twice and the solution using rewinddir(), and my favourite method of doing stuff, &t4 dosen't look that good either if you are going for peak performance. The fastest solution takes only half the time, and scanning the whole NTFS HD did take some time as you see :). So once again the rule number one of optimizing holds. Benchmark, benchmark, benchmark.
-
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.
|