Skip to content

Commit

Permalink
c: arbitrarily adjust buffer size
Browse files Browse the repository at this point in the history
Looks nicer and doesn't seem to affect performance.
  • Loading branch information
rmg committed Aug 9, 2019
1 parent 95a4904 commit fa166af
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fa166af

Please sign in to comment.