[Xperia Z3 Tablet Compact Original Android Developm] shrek42:
Encrypted device benchmarks

For anyone interested in device encryption: I've done some rather simple benchmarks with and without encrypted data partition. As usual benchmarks can depend on many parameters and conditions. So don't take the results to seriously. Every benchmark has been run three times to gather some insight about the fluctuations of the results.

Device: Sony Xpera Z3 tablet compact LTE (SGP621)

LineageOS version: lineage-14.1-20170605-UNOFFICIAL-Lowtraxx-scorpion

(C) = Command

(N) = Not encrypted /data partition

(E) = Encrypted /data partition

*** (1) Write 1 TB of data, sequential stream, without final sync:

(C) time busybox dd if=/dev/zero of=/sdcard/test.dat bs=1M count=1000

(N) real-time: 0m21.06s 0m20.93s 0m22.41s

(E) real-time: 0m23.27s 0m24.01s 0m23.17s

*** (2) Write 1 TB of data, sequential stream, with final sync:

(C) time busybox dd if=/dev/zero of=/sdcard/test.dat bs=1M count=1000 conv=fsync

(N) real-time: 0m39.82s 0m40.15s 0m36.48s

(E) real-time: 0m59.34s 0m59.05s 0m59.88s

==> Possible conclusion: As long as the written data fits into memory

and is not synced to disk immediately, there is no large penalty for

encryption (1). But on the other hand as soon as the data is written

to disk (2), the encryption lowers the write performance by roughly

a factor of 1.5.

*** (3) Read 1TB of data, sequential stream, without reboot:

(C) time busybox dd if=/sdcard/test.dat of=/dev/null bs=1M count=1000

(N) real-time: 0m01.46s 0m01.20s 0m01.27s

(E) real-time: 0m01.57s 0m01.25s 0m01.38s

*** (4) Read 1TB of data, sequential stream, with reboots in-between each run:

(C) time busybox dd if=/sdcard/test.dat of=/dev/null bs=1M count=1000

(N) real-time: 0m05.06s 0m05.14s 0m05.12s

(E) real-time: 0m29.40s 0m23.65s 0m27.60s

==> Possible conclusions: In case of 'read' the situation is even more

drastic. As long as the data can be read from buffers in memory (3),

there is no difference between the encrypted and not encrypted

partition. But as soon as the data is read from the device (4), the

penalty for decrypting the data makes the read process slower by

roughly a factor 5-6.

Maybe this is one of the reasons why G* decided not to enable

encryption by default on that old Qualcom Snapdragon 801 CPU.

BTW: The speed difference is not only theoretical (in the benchmarks)

but also quite nasty to feel when i.e. starting OsmAnd and loading

a new offline map - which can be already slow without encryption,

but an agony with it. Furthermore if many auto-start apps are

installed, the boot process will be much longer as well, of course.

In summary the encrypted device feels much slower when starting

new apps or working with large amounts of data (i.e. image gallery),

but working with it is ok as long as the typical set of apps and data

fits into memory (and stays there).

---------- Post added at 03:11 PM ---------- Previous post was at 02:39 PM ----------

Just some info about how to create full backups of an encrypted data partition:

A full backup to a local computer via ADB of an encrypted /data-partition

is only possible when the backup procedure can decipher the partition

and backup all files. Luckily one can switch the adb daemon of LineageOS

to run as root, so a full backup of an encrypted /data-partition is possible.

Nevertheless I tested the same procedure (adb-based full-backup)

with koron393's latest TWRP version

TWRP_multirom_scorpion_3.1.0.0_3.10_201703.img

once more. Unfortunately this TWRP version still can not decrypt

the encrypted /data-partition of

lineage-14.1-20170605-UNOFFICIAL-Lowtraxx-scorpion

For a backup this does not hurt anymore (since one should be able to

backup via LineageOS).

Then again for repairing some files on an encrypted /data partition (i.e

when LineageOS does not boot) it would still be very nice to be able

to mount via TWRP. But that's of course nothing we can fix here ...