I ran this myself, and
visnu's code is broken in your benchmarking.
visnu's code is checking the %common hash for the common
words, and you don't have such a hash defined. Since the
other benchmarked code has setup code within the benchmarks
(setting up the common words hash), we should do that for
visnu's, so add this at the beginning:
my %common;
@common{@common} = (1) x @common;
Also, the
PMGurus code doesn't work quite right, as it doesn't
lower-case the words in the
grep.
After taking out the PMGurus code, and fixing up visnu's,
I got:
Benchmark: timing 1000 iterations of Odud, btrott, visnu...
Odud: 4 secs ( 3.55 usr 0.00 sys = 3.55 cpu)
btrott: 2 secs ( 2.27 usr 0.00 sys = 2.27 cpu)
visnu: 4 secs ( 3.98 usr 0.00 sys = 3.98 cpu)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.