I wonder if anyone could offer any suggestions to improve the performance of binary data writing on an old enterprise Android 5.1 device.
FileOutputStream fileOutputStream = new FileOutputStream(fileDescriptor);
BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream);
byte[] abData = new byte[1024*1024];
long lStart = System.currentTimeMillis();
for(int i= 0; i < 30; i++){
bos.write(abData);
}
long lDuration = System.currentTimeMillis() - lStart;
utility.logDebug("OEDebug: duration (MS): " + lDuration);
The execution of the above testing code to write 30MB data takes about 1.2 seconds. If FileOutputStream is used directly instead of the BufferedOutputStream, the outcome is virtually the same. We deal with files with sizes of hundreds of MB. Writing them takes well over 10 seconds each. Is there anything that I can try to improve the speed?
Improving the performance of binary data writing on an old Android 5.1 device can be challenging due to hardware limitations and the age of the operating system. However, there are several strategies you can try to optimize the writing process:
Notes: