From 23647be07ab827491de4d9803c561e7e074bce7c Mon Sep 17 00:00:00 2001 From: Jan Verbeek Date: Fri, 27 Aug 2021 20:12:12 +0200 Subject: [PATCH] cat: Use larger splice size This raises performance by 10-20% or so. --- src/uu/cat/src/splice.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/cat/src/splice.rs b/src/uu/cat/src/splice.rs index 5ce5f2b62..26802c7e6 100644 --- a/src/uu/cat/src/splice.rs +++ b/src/uu/cat/src/splice.rs @@ -5,6 +5,7 @@ use std::os::unix::io::{AsRawFd, RawFd}; use uucore::pipes::{pipe, splice, splice_exact}; +const SPLICE_SIZE: usize = 1024 * 128; const BUF_SIZE: usize = 1024 * 16; /// This function is called from `write_fast()` on Linux and Android. The @@ -22,7 +23,7 @@ pub(super) fn write_fast_using_splice( let (pipe_rd, pipe_wr) = pipe()?; loop { - match splice(&handle.reader, &pipe_wr, BUF_SIZE) { + match splice(&handle.reader, &pipe_wr, SPLICE_SIZE) { Ok(n) => { if n == 0 { return Ok(false);