[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Don't do unneccesary memory copies in dd.
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] Don't do unneccesary memory copies in dd. |
Date: |
Fri, 21 Nov 2008 11:26:06 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Jim Meyering wrote:
> I was disappointed to see no performance improvement.
> But it's not too surprising: this affects dd only with a block
> size that's so low (512) that the cost of the memcpy is
> lost in the noise of the read/write syscalls.
> Maybe on some small/old CPU it actually does make a difference.
You could test the difference with the less common case
where both [io]bs are specified.
$ ./dd-before ibs=1M obs=1M if=/dev/zero of=/dev/null count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 0.100523 s, 1.0 GB/s
$ ./dd ibs=1M obs=1M if=/dev/zero of=/dev/null count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 0.188189 s, 5.3 GB/s
$ ./dd ibs=1M obs=512K if=/dev/zero of=/dev/null count=1000
1000+0 records in
2000+0 records out
1048576000 bytes (1.0 GB) copied, 0.635144 s, 1.7 GB/s
As an aside, I noticed that my fedora 8 system performance
got increasingly worse as the buffers increased beyond 512KiB?
This suggests that the read syscalls take longer with bigger ibs:
$ strace -e read -c ./dd ibs=1M obs=1M if=/dev/zero of=/dev/null count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 0.231632 s, 4.5 GB/s
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 0.037833 38 1005 read
$ strace -e read -c ./dd ibs=10M obs=10M if=/dev/zero of=/dev/null count=100
100+0 records in
100+0 records out
1048576000 bytes (1.0 GB) copied, 1.06246 s, 987 MB/s
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
100.00 1.030802 9817 105 read
While this suggests the dd process takes longer (user time)
with bigger obs:
$ time ./dd ibs=1M obs=512K if=/dev/zero of=/dev/null count=1000
1000+0 records in
2000+0 records out
1048576000 bytes (1.0 GB) copied, 0.601005 s, 1.7 GB/s
real 0m0.603s
user 0m0.375s
sys 0m0.228s
$ time ./dd ibs=1M obs=2M if=/dev/zero of=/dev/null count=1000
1000+0 records in
500+0 records out
1048576000 bytes (1.0 GB) copied, 1.74316 s, 602 MB/s
real 0m1.761s
user 0m1.096s
sys 0m0.477s
Pádraig.