Making the high buffer only one page size is faster for sliding mmap mode

This commit is contained in:
Con Kolivas 2015-03-10 21:10:24 +11:00
parent d5a339335b
commit 9a17a54c49

7
rzip.c
View file

@ -843,12 +843,9 @@ init_sliding_mmap(rzip_control *control, struct rzip_state *st, int fd_in,
{ {
struct sliding_buffer *sb = &control->sb; struct sliding_buffer *sb = &control->sb;
/* Initialise the high buffer */ /* Initialise the high buffer. One page size is fastest to manipulate */
if (!STDIN) { if (!STDIN) {
sb->high_length = 65536; sb->high_length = control->page_size;
/* Round up to the next biggest page size */
if (sb->high_length % control->page_size)
sb->high_length += control->page_size - (sb->high_length % control->page_size);
sb->buf_high = (uchar *)mmap(NULL, sb->high_length, PROT_READ, MAP_SHARED, fd_in, offset); sb->buf_high = (uchar *)mmap(NULL, sb->high_length, PROT_READ, MAP_SHARED, fd_in, offset);
if (unlikely(sb->buf_high == MAP_FAILED)) if (unlikely(sb->buf_high == MAP_FAILED))
failure("Unable to mmap buf_high in init_sliding_mmap\n"); failure("Unable to mmap buf_high in init_sliding_mmap\n");