summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--src/split.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 9fad8a775..e07b10e31 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,11 @@ GNU coreutils NEWS -*- outline -*-
due to -i, or -u. Instead they only output this information with --debug.
I.e., 'cp -u -v' etc. will have the same verbosity as before coreutils-9.3.
+** Improvements
+
+ split now uses more tuned access patterns for its potentially large input.
+ This was seen to improve throughput by 5% when reading from SSD.
+
* Noteworthy changes in release 9.3 (2023-04-18) [stable]
diff --git a/src/split.c b/src/split.c
index d872ec56a..09209cc5a 100644
--- a/src/split.c
+++ b/src/split.c
@@ -32,6 +32,7 @@
#include "alignalloc.h"
#include "die.h"
#include "error.h"
+#include "fadvise.h"
#include "fd-reopen.h"
#include "fcntl--.h"
#include "full-write.h"
@@ -1621,6 +1622,9 @@ main (int argc, char **argv)
/* Binary I/O is safer when byte counts are used. */
xset_binary_mode (STDIN_FILENO, O_BINARY);
+ /* Advise the kernel of our access pattern. */
+ fdadvise (STDIN_FILENO, 0, 0, FADVISE_SEQUENTIAL);
+
/* Get the optimal block size of input device and make a buffer. */
if (fstat (STDIN_FILENO, &in_stat_buf) != 0)