From fa166af6f6df2eb01c33a5cdb8c5a43dd9eb81e7 Mon Sep 17 00:00:00 2001 From: Ryan Graham Date: Thu, 8 Aug 2019 16:53:07 -0700 Subject: [PATCH] c: arbitrarily adjust buffer size Looks nicer and doesn't seem to affect performance. --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 2d6a613..b63a46d 100644 --- a/main.c +++ b/main.c @@ -328,9 +328,12 @@ static int_fast32_t scan_all_slow(const unsigned char *buf, const unsigned char return count; } -static const size_t MAX_BUF = 64*1024; - int main(int argc, const char *argv[]) { + // 256k sounds nice. + // 64*4k pages or 128*2k pages or 512*512b fs blocks + // small enough for stack allocation + // small enough to fit in cache on modern CPU + const size_t MAX_BUF = 64*4096; unsigned char buf[MAX_BUF]; int_fast32_t remainder = 0; INST(size_t total_read = 0);