I'm a little wary of this being too aggressive,
but it does give a noticeable (13%) boost on my new laptop.
Here are the numbers from dd bs=$blksize if=/dev/zero of=/dev/null
blksize system-1 system-2
----------------------------
1024 734 MB/s 1.7 GB/s
2048 1.3 GB/s 3.0 GB/s
4096 2.4 GB/s 5.1 GB/s
8192 3.5 GB/s 7.3 GB/s
16384 3.9 GB/s 9.4 GB/s
32768 5.2 GB/s 9.9 GB/s
65536 5.3 GB/s 11.2 GB/s
131072 5.5 GB/s 11.8 GB/s
262144 5.7 GB/s 11.6 GB/s
524288 5.7 GB/s 11.4 GB/s
1048576 5.8 GB/s 11.4 GB/s
cheers,
Pádraig.
>From 1dcd99142e49d3ec7762d657aef868af1fc4d438 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 21 Jul 2011 08:25:49 +0100
Subject: [PATCH] cat,cp,mv,install,split: Set the minimum IO block size used
to 64KiB
* NEWS: Mention the change in behavior.
* src/ioblksize.h: Add updated test results and
increase value from 32KiB to 64KiB.
---
NEWS | 4 ++++
src/ioblksize.h | 41 +++++++++++++++++++++++------------------
2 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/NEWS b/NEWS
index 2952dc9..13a4a25 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,10 @@ GNU coreutils NEWS -*- outline -*-
** Changes in behavior
+ cp,mv,install,cat,split: now read and write a minimum of 64KiB at a time.
+ This was previously 32KiB and increasing to 64KiB was seen to increase
+ throughput by 13% when reading cached files on 64 bit GNU/Linux for example.
+
chmod, chown and chgrp now output the original attributes in messages,
when -v or -c specified.
diff --git a/src/ioblksize.h b/src/ioblksize.h
index eaeced3..d819cf9 100644
--- a/src/ioblksize.h
+++ b/src/ioblksize.h
@@ -20,30 +20,35 @@
#include "stat-size.h"
-/* As of Mar 2009, 32KiB is determined to be the minimium
+/* As of Jul 2011, 64KiB is determined to be the minimium
blksize to best minimize system call overhead.
- This can be tested with this script with the results
- shown for a 1.7GHz pentium-m with 2GB of 400MHz DDR2 RAM:
+ This can be tested with this script:
for i in $(seq 0 10); do
- size=$((8*1024**3)) #ensure this is big enough
bs=$((1024*2**$i))
printf "%7s=" $bs
- dd bs=$bs if=/dev/zero of=/dev/null count=$(($size/$bs)) 2>&1 |
- sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p'
+ timeout --foreground -sINT 1 \
+ dd bs=$bs if=/dev/zero of=/dev/null 2>&1 |
+ sed -n 's/.* \([0-9.]* [GM]B\/s\)/\1/p'
done
- 1024=734 MB/s
- 2048=1.3 GB/s
- 4096=2.4 GB/s
- 8192=3.5 GB/s
- 16384=3.9 GB/s
- 32768=5.2 GB/s
- 65536=5.3 GB/s
- 131072=5.5 GB/s
- 262144=5.7 GB/s
- 524288=5.7 GB/s
- 1048576=5.8 GB/s
+ With the results shown for these two systems:
+ system-1 = 1.7GHz pentium-m with 400MHz DDR2 RAM, arch=i686
+ system-2 = 2.1GHz i3-2310M with 1333MHz DDR3 RAM, arch=x86_64
+
+ blksize system-1 system-2
+ ----------------------------
+ 1024 734 MB/s 1.7 GB/s
+ 2048 1.3 GB/s 3.0 GB/s
+ 4096 2.4 GB/s 5.1 GB/s
+ 8192 3.5 GB/s 7.3 GB/s
+ 16384 3.9 GB/s 9.4 GB/s
+ 32768 5.2 GB/s 9.9 GB/s
+ 65536 5.3 GB/s 11.2 GB/s
+ 131072 5.5 GB/s 11.8 GB/s
+ 262144 5.7 GB/s 11.6 GB/s
+ 524288 5.7 GB/s 11.4 GB/s
+ 1048576 5.8 GB/s 11.4 GB/s
Note that this is to minimize system call overhead.
Other values may be appropriate to minimize file system
@@ -58,7 +63,7 @@
In the future we could use the above method if available
and default to io_blksize() if not.
*/
-enum { IO_BUFSIZE = 32*1024 };
+enum { IO_BUFSIZE = 64*1024 };
static inline size_t
io_blksize (struct stat sb)
{
--
1.7.5.2