On 8/27/2010 3:37 PM, Adam Morris wrote:
> I believe that copying to /dev/null would go so quickly that it wouldn't be a valid test.
> 
> I tested this on my local filesystem:
> 
> 	$ dd if=/dev/zero of=./testfile bs=1024K count=1000
> 	1000+0 records in
> 	1000+0 records out
> 	1048576000 bytes (1.0 GB) copied, 9.25593 s, 113 MB/s
> 	$ dd if=/dev/zero of=/dev/null bs=1024K count=1000
> 	1000+0 records in
> 	1000+0 records out
> 	1048576000 bytes (1.0 GB) copied, 0.28883 s, 3.6 GB/s
> 
> The difference here, IIRC, is that /dev/null is just a bit bucket that immediately and instantly discards whatever is copied to it.  The speed comes from the fact that /dev/null doesn't exercise the disk in this case.
> 
> -Adam
> 

Both /dev/zero and /dev/null both act as data sinks. /dev/null is not a source of any data.

In effect when piping data from /dev/zero to /dev/null does not touch your FS in any way ,
but really is in effect a stress test of sorts of your CPU. How fast can the CPU produce
null characters.

Try a 'screen cat /dev/zero > /dev/null' and take a gander at 'top' and watch your CPU
time disappear.