Commit e1754ddc authored by Przemyslaw Szczepaniak's avatar Przemyslaw Szczepaniak
Browse files

Increase ZipFile read buffers size to 64k

Fixes performance regression introduced in Android N.
Increased size of buffer for Inflater in ZipFile.getInputStream from 8k to 64k.
Replaced temp stack in bufferZipFile_read with GetByteArrayElements.

ZipFileReadBenchmark results on pixel device:

Without the change:
Experiment {instrument=runtime, benchmarkMethod=timeZipFileRead, vm=default, parameters={readBufferSize=1024}}
  runtime(ns): min=11591794.71, 1st qu.=11591794.71, median=11591794.71, mean=11591794.71, 3rd qu.=11591794.71, max=11591794.71
Experiment {instrument=runtime, benchmarkMethod=timeZipFileRead, vm=default, parameters={readBufferSize=16384}}
  runtime(ns): min=4913842.09, 1st qu.=4913842.09, median=4913842.09, mean=4913842.09, 3rd qu.=4913842.09, max=4913842.09
Experiment {instrument=runtime, benchmarkMethod=timeZipFileRead, vm=default, parameters={readBufferSize=65536}}
  runtime(ns): min=4888673.69, 1st qu.=4888673.69, median=4888673.69, mean=4888673.69, 3rd qu.=4888673.69, max=4888673.69

With the change:
Experiment {instrument=runtime, benchmarkMethod=timeZipFileRead, vm=default, parameters={readBufferSize=1024}}
  runtime(ns): min=11415217.04, 1st qu.=11415217.04, median=11415217.04, mean=11415217.04, 3rd qu.=11415217.04, max=11415217.04
Experiment {instrument=runtime, benchmarkMethod=timeZipFileRead, vm=default, parameters={readBufferSize=16384}}
  runtime(ns): min=2690763.53, 1st qu.=2690763.53, median=2690763.53, mean=2690763.53, 3rd qu.=2690763.53, max=2690763.53
Experiment {instrument=runtime, benchmarkMethod=timeZipFileRead, vm=default, parameters={readBufferSize=65536}}
  runtime(ns): min=2202639.03, 1st qu.=2202639.03, median=2202639.03, mean=2202639.03, 3rd qu.=2202639.03, max=2202639.03

Test: vogar run of test in *.java.util.zip packages
Bug: 65491407
Change-Id: I7734dde9e6e02b1fbff7209c1256a16ded1654e6
parent 8ff19401
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment