Bug #7205
IOCipher Performance
Status: | New | Start date: | 04/24/2016 | |
---|---|---|---|---|
Priority: | High | Due 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.
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
- File pv performance test 8K 2016-04-30 .png added
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.