From 73d5c4474b9a00f81f6f47a094bbf6e8f131385a Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Fri, 10 Mar 2023 12:12:24 +0100 Subject: [PATCH] shred: expand buffer size from 512 to 65536 to reduce write calls This buffer size matches GNU --- src/uu/shred/src/shred.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uu/shred/src/shred.rs b/src/uu/shred/src/shred.rs index 75967a3dd..dad88b834 100644 --- a/src/uu/shred/src/shred.rs +++ b/src/uu/shred/src/shred.rs @@ -25,7 +25,8 @@ use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; use uucore::libc::S_IWUSR; use uucore::{format_usage, show, show_if_err, util_name}; -const BLOCK_SIZE: usize = 512; +// This block size seems to match GNU (2^16 = 65536) +const BLOCK_SIZE: usize = 1 << 16; const NAME_CHARSET: &[u8] = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_."; // Patterns as shown in the GNU coreutils shred implementation