Bug #7205

IOCipher Performance

Added by knewye over 1 year ago. Updated over 1 year ago.

Status:NewStart date:04/24/2016
Priority:HighDue date:
Assignee:-% Done:

0%

Category:-
Target version:0.3.1
Component:

Description

An Android app I am building is having performance issues.
An attachment shows performance test results. For example writing a 10 meg file on the standard Android filesystem takes 547 ms. The same operation on IOCipher requires 19780 ms.

Given SQLCipher is under the hood, what tuning can I do to improve performance?
For example, copy file uses a 1024 byte buffer. Can the size be changed to match the record size used in SQLCIpher?

public static void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
}
in.close();
out.close();
}

Better yet, what is the fastest way to duplicate an IOCipher file? The copy file algorithm shown when used to duplicate a file requires 599 ms on a standard Android filesystem and 25851 on IOCipher.

Thanks in advance for any tips or suggestions.

pv performance test 2016-04-24.png - Test results (29.9 KB) knewye, 04/24/2016 06:37 pm

pv performance test 8K 2016-04-30 .png (29.8 KB) knewye, 04/30/2016 10:40 am

History

#1 Updated by knewye over 1 year ago

An implementation of the com.google.common.io, Files class would help.

#2 Updated by knewye over 1 year ago

Changing the block size from 1K to 8K helps. Writing a 10 meg file goes from 19780 ms down to 2997 ms. The 8K block also improves Android performance from 547 ms to 164 ms. IOCipher is still more than an order of magnitude slower than the native filesystem.

Also available in: Atom PDF