mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 12:37:49 +00:00
cat: Use larger splice size
This raises performance by 10-20% or so.
This commit is contained in:
parent
d002810a47
commit
23647be07a
1 changed files with 2 additions and 1 deletions
|
@ -5,6 +5,7 @@ use std::os::unix::io::{AsRawFd, RawFd};
|
||||||
|
|
||||||
use uucore::pipes::{pipe, splice, splice_exact};
|
use uucore::pipes::{pipe, splice, splice_exact};
|
||||||
|
|
||||||
|
const SPLICE_SIZE: usize = 1024 * 128;
|
||||||
const BUF_SIZE: usize = 1024 * 16;
|
const BUF_SIZE: usize = 1024 * 16;
|
||||||
|
|
||||||
/// This function is called from `write_fast()` on Linux and Android. The
|
/// 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()?;
|
let (pipe_rd, pipe_wr) = pipe()?;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match splice(&handle.reader, &pipe_wr, BUF_SIZE) {
|
match splice(&handle.reader, &pipe_wr, SPLICE_SIZE) {
|
||||||
Ok(n) => {
|
Ok(n) => {
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue