Updating HPKE to draft-irtf-cfrg-hpke-07 added a number of tests to crypto/hpke/hpke_test_vectors.txt. The time to run HPKE crypto tests increased from 0.09 to 0.56 seconds (averaged over 6 runs). The runtime for the whole crypto_test suite increased from 86.44 to 88.19 (measured once). Profiling revealed an excessive amount of CPU time (~50% for HPKE tests) spent on std::map lookups in ReadNext(). I found a slow loop that computes the suffix for a repeated attribute by hammering a std::map with incremental guesses. This CL adds a std::map<std::string, size_t> for counting repeated attributes, eliminating the need for the loop. This reduces the runtime for HPKE tests from 0.56 to 0.12 seconds (averaged over 6 runs). For the whole crypto_test suite, runtime is reduced from 88.19 to 86.71 seconds (measured once). Change-Id: Ie87f4a7f3edc95d434226d2959dcf09974f0656f Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/44905 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: David Benjamin <davidben@google.com>chromium-5359
parent
5dd18d017d
commit
13da180506
2 changed files with 8 additions and 5 deletions
Loading…
Reference in new issue