diff options
| author | Pádraig Brady <P@draigBrady.com> | 2010-07-20 18:51:01 +0100 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2010-07-22 01:04:47 +0100 |
| commit | 47076e3c7c22fc7557f388ad3d47228b922da71e (patch) | |
| tree | 94f785d628a11e6c786f5aa85daa88d2a672b2fe /src/cat.c | |
| parent | fadvise: new module providing a simpler interface to posix_fadvise (diff) | |
| download | coreutils-47076e3c7c22fc7557f388ad3d47228b922da71e.tar.gz coreutils-47076e3c7c22fc7557f388ad3d47228b922da71e.zip | |
provide POSIX_FADV_SEQUENTIAL hint to appropriate utils
Following on from commit dae35bac, 01-03-2010,
"sort: inform the system about our input access pattern"
apply the same hint to all appropriate utils.
This currently gives around a 5% speedup for reading
large files from fast flash devices on GNU/Linux.
* src/base64.c: Call fadvise (..., FADVISE_SEQUENTIAL);
* src/cat.c: Likewise.
* src/cksum.c: Likewise.
* src/comm.c: Likewise.
* src/cut.c: Likewise.
* src/expand.c: Likewise.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/join.c: Likewise.
* src/md5sum.c: Likewise.
* src/nl.c: Likewise.
* src/paste.c: Likewise.
* src/pr.c: Likewise.
* src/ptx.c: Likewise.
* src/shuf.c: Likewise.
* src/sum.c: Likewise.
* src/tee.c: Likewise.
* src/tr.c: Likewise.
* src/tsort.c: Likewise.
* src/unexpand.c: Likewise.
* src/uniq.c: Likewise.
* src/wc.c: Likewise, unless we don't actually read().
Diffstat (limited to 'src/cat.c')
| -rw-r--r-- | src/cat.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -34,6 +34,7 @@ #include "system.h" #include "error.h" +#include "fadvise.h" #include "full-write.h" #include "quote.h" #include "safe-read.h" @@ -700,6 +701,8 @@ main (int argc, char **argv) } insize = io_blksize (stat_buf); + fdadvise (input_desc, 0, 0, FADVISE_SEQUENTIAL); + /* Compare the device and i-node numbers of this input file with the corresponding values of the (output file associated with) stdout, and skip this input file if they coincide. Input |
