An attempt on Linux failed clearing the file cache. Thus an update and results from a Linux box.

This works: sudo bash -c "echo 1 >/proc/sys/vm/drop_caches"

Results:

$ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time wc lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m3.412s user 0m3.307s sys 0m0.097s $ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time ./wc.pl lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m0.613s (5.57x) user 0m4.168s sys 0m0.432s

Beyond 8 cores:

The --max-workers option defaults to auto (8 workers max). Running with --max-workers=N beyond 8 may provide extra performance on a box with more than 8 "real" cores.

$ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time ./wc.pl --max-workers=8 lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m0.613s (5.57x) user 0m4.168s sys 0m0.432s $ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time ./wc.pl --max-workers=12 lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m0.454s (7.52x) user 0m4.464s sys 0m0.536s $ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time ./wc.pl --max-workers=16 lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m0.360s (9.48x) user 0m4.344s sys 0m0.625s

Compare wc with wc.pl 1 and 2 cores:

To complete the demonstration, I also tried wc.pl with --maxworkers=1 and --maxworkers=2. The timings for wc.pl include loading Perl plus modules and spawning/reaping workers.

$ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time wc lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m3.412s user 0m3.307s sys 0m0.097s $ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time ./wc.pl --max-workers=1 lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m3.553s user 0m3.363s sys 0m0.329s $ sudo bash -c "echo 1 >/proc/sys/vm/drop_caches" $ time ./wc.pl --max-workers=2 lesms10_big.txt 14152200 113528600 652751200 lesms10_big.txt real 0m1.804s user 0m3.339s sys 0m0.357s

See also, egrep.pl from mce-examples.


In reply to Re^5: Suffix-prefix matching done right by Anonymous Monk
in thread Suffix-prefix matching done right by baxy77bax

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.