mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
cat: Use larger splice size
This raises performance by 10-20% or so.
This commit is contained in:
@@ -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<R: FdReadable>(
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user