Re: Perl Quiz of the Week #23

Mark Jason Dominus <[email protected]>
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
[email protected] (Kurt Starsinic):
>     % time parens 12 > /dev/null
>     real    0m4.541s
>     user    0m4.460s
>     sys     0m0.012s
> 
>     The "tail" version has to generate all the output, it just doesn't
> have to display most of it to the s*l*o*w tty.  Interestingly, the
> "/dev/null" version isn't that much faster, which reinfoces the idea
> that the slowness isn't in the I/O subsystem per se, but rather in the
> tty driver specifically.

I don't think the > /dev/null version is using the TTY driver.  Why
would it be?

The data *does* have to be copied into the kernel buffer.  But from
there the kernel invokes the device driver, which in this case returns
immediately.

I guess that you will not see much decrease in time if you remove the
printing from your program.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.