I did a test where I did this, and increasing the %url population from 1000 to 100_000 caused each algorithm to take over 100 times longer.
the change is:
old:
my %url = ( monday => { @{[map(($_,1), (1..1000))]} } );
new:
my %url = ( monday => { @{[map(($_,1), (1..100_000))]} } );
I turned the iterations down for the large dataset, because otherwise I would be posting tomorrow instead of today. ;)
results are:
Large dataset |
---|
Benchmark: timing 100 iterations of Grep, Max, Ternary...
Grep: 83 wallclock secs (80.90 usr + 0.02 sys = 80.92 CPU) @ 1.24/s (n=100)
Max: 74 wallclock secs (71.38 usr + 0.00 sys = 71.38 CPU) @ 1.40/s (n=100)
Ternary: 77 wallclock secs (74.15 usr + 0.00 sys = 74.15 CPU) @ 1.35/s (n=100)
|
Small dataset |
---|
Benchmark: timing 10000 iterations of Grep, Max, Ternary...
Grep: 73 wallclock secs (68.50 usr + 0.05 sys = 68.55 CPU) @ 145.88/s (n=10000)
Max: 61 wallclock secs (57.77 usr + 0.05 sys = 57.82 CPU) @ 172.95/s (n=10000)
Ternary: 64 wallclock secs (61.54 usr + 0.02 sys = 61.56 CPU) @ 162.44/s (n=10000)
|
Can you post the rest of the Benchmark output?
Paris Sinclair | 4a75737420416e6f74686572
pariss@efn.org | 205065726c204861636b6572
I wear my Geek Code on my finger.
-
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.
|