xz: Take advantage of LZMA_FULL_BARRIER with --block-list.

Now if --block-list is used in threaded mode, the encoder
won't need to flush at each Block boundary specified via
--block-list. This improves performance a lot, making
threading helpful with --block-list.

The flush timer was reset after LZMA_FULL_FLUSH but since
LZMA_FULL_BARRIER doesn't flush, resetting the timer is
no longer done.
This commit is contained in:
Lasse Collin 2013-10-22 19:51:55 +03:00
parent 0cd45fc2bc
commit ba413da1d5
1 changed files with 15 additions and 17 deletions

View File

@ -584,7 +584,7 @@ coder_normal(file_pair *pair)
// opt_block_size bytes of input. // opt_block_size bytes of input.
block_remaining -= strm.avail_in; block_remaining -= strm.avail_in;
if (block_remaining == 0) if (block_remaining == 0)
action = LZMA_FULL_FLUSH; action = LZMA_FULL_BARRIER;
} }
if (action == LZMA_RUN && flush_needed) if (action == LZMA_RUN && flush_needed)
@ -605,13 +605,11 @@ coder_normal(file_pair *pair)
} }
if (ret == LZMA_STREAM_END && (action == LZMA_SYNC_FLUSH if (ret == LZMA_STREAM_END && (action == LZMA_SYNC_FLUSH
|| action == LZMA_FULL_FLUSH)) { || action == LZMA_FULL_BARRIER)) {
// Flushing completed. Write the pending data out if (action == LZMA_SYNC_FLUSH) {
// immediatelly so that the reading side can // Flushing completed. Write the pending data
// decompress everything compressed so far. Do this // out immediatelly so that the reading side
// also with LZMA_FULL_FLUSH because if it is combined // can decompress everything compressed so far.
// with timed LZMA_SYNC_FLUSH the same flushing
// timer can be used.
if (io_write(pair, &out_buf, IO_BUFFER_SIZE if (io_write(pair, &out_buf, IO_BUFFER_SIZE
- strm.avail_out)) - strm.avail_out))
break; break;
@ -619,7 +617,10 @@ coder_normal(file_pair *pair)
strm.next_out = out_buf.u8; strm.next_out = out_buf.u8;
strm.avail_out = IO_BUFFER_SIZE; strm.avail_out = IO_BUFFER_SIZE;
if (action == LZMA_FULL_FLUSH) { // Set the time of the most recent flushing.
mytime_set_flush_time();
} else {
// Start a new Block after LZMA_FULL_BARRIER.
if (opt_block_list == NULL) { if (opt_block_list == NULL) {
block_remaining = opt_block_size; block_remaining = opt_block_size;
} else { } else {
@ -633,9 +634,6 @@ coder_normal(file_pair *pair)
} }
} }
// Set the time of the most recent flushing.
mytime_set_flush_time();
// Start a new Block after LZMA_FULL_FLUSH or continue // Start a new Block after LZMA_FULL_FLUSH or continue
// the same block after LZMA_SYNC_FLUSH. // the same block after LZMA_SYNC_FLUSH.
action = LZMA_RUN; action = LZMA_RUN;