Cut down on object allocation in CipherInputStream
While installing large encrypted app, GC used to collect large number of objects because when the data was being read from the input stream, it used to place the same on a new byte array leaving the last allocated array unused. The same behavior was not observed on Android N maybe due to changes in GC, however, it was creating the objects in a similar way it used to create in older versions. This increases speed of CipherInputStreamBenchmark from 54ms to 28 ms. Test: libcore.javax.crypto.CipherInputStreamTest Test: org.apache.harmony.crypto.tests.javax.crypto.CipherInputStreamTest Test: org.apache.harmony.crypto.tests.javax.crypto.CipherInputStream1Test Bug: 6478569 Change-Id: I0cf0dc37e6513c08abcf2f3077db3dc9e6395b62
Loading
Please sign in to comment