Thanks for putting in the effort to test my wild guess (++).

On my machine, Your test gets me 2174 echo per second, which is around 460 MICRO seconds each - yes , still not in NANO seconds.
(It helps that I am writing to an SSD disk)

I updated the code slightly to get closer to the "echo" open/close of the file, and append to it, and 10x the iterations:

use strict; use warnings; use Benchmark 'cmpthese'; cmpthese (100000, { 'print' => sub { open my $fh, '>>', '/tmp/wp.txt' or die $!; print $fh "x\n"; close $fh; }, 'echo' => sub { system "echo x >> /tmp/we.txt"; } } ); exit;
This gives me:
Rate echo print echo 2168/s -- -98% print 140845/s 6397% --
Where the perl performance is pushing the limits of nanoseconds, at 7100 nanoseconds per write.

In any case, the lesson learned is that perl is about 70 times faster than "echo".

        This is not an optical illusion, it just looks like one.


In reply to Re^5: snmpget is missing some values by NetWallah
in thread snmpget is missing some values by leostereo

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.