Decrease OTA package verification times further.

Timing from Nexus 5X:

      89 MiB OTA update package: 1.4 s -> 0.6 s (decreased by 57%)
    1196 MiB OTA update package: 8.0 s -> 7.5 s (decreased by 6%)

Bug: http://b/28135231
Change-Id: Id91f2ad15df2bffb9f8a4b4ec5a57657a02847ec
This commit is contained in:
Elliott Hughes 2016-04-19 15:24:38 -07:00
parent e8d0ecccf7
commit dd895d0ada

View file

@ -206,10 +206,10 @@ int verify_file(unsigned char* addr, size_t length,
double frac = -1.0; double frac = -1.0;
size_t so_far = 0; size_t so_far = 0;
while (so_far < signed_len) { while (so_far < signed_len) {
// On a Nexus 9, experiment didn't show any performance improvement with // On a Nexus 5X, experiment showed 16MiB beat 1MiB by 6% faster for a
// larger sizes past 1MiB, and they reduce the granularity of the progress // 1196MiB full OTA and 60% for an 89MiB incremental OTA.
// bar. http://b/28135231. // http://b/28135231.
size_t size = std::min(signed_len - so_far, 1 * MiB); size_t size = std::min(signed_len - so_far, 16 * MiB);
if (need_sha1) SHA1_Update(&sha1_ctx, addr + so_far, size); if (need_sha1) SHA1_Update(&sha1_ctx, addr + so_far, size);
if (need_sha256) SHA256_Update(&sha256_ctx, addr + so_far, size); if (need_sha256) SHA256_Update(&sha256_ctx, addr + so_far, size);