Conversation
Decrease default autotype delay to 1 to improve test suite speed by seconds. This shaves multiple seconds off the whole test suite. In some cases, the largest part. Also, initialize config just creating the test instance, just in case that it ever depends on the configuration values at that point already.
This speeds up the Kdbx4 tests by using parameters optimized for speed for the key derivation functions. On an i7-6700K the tests run close to 50% faster with this change (about 1.5s vs. 3s).
|
What is really slow is the ridiculous number of test executables we have to link. Good work on these! |
tests/TestKdbx4.cpp
Outdated
| kdf->setRounds(1); | ||
| kdf->processParameters({ | ||
| {KeePass2::KDFPARAM_ARGON2_MEMORY, 1024}, | ||
| {KeePass2::KDFPARAM_ARGON2_PARALLELISM, 1} |
There was a problem hiding this comment.
You cannot just use Argon2 unconditionally. The test must not make assumptions about which part of changing the KDF triggers the KDBX 4 upgrade. Imagine we introduce a bug where only Argon2 triggers the upgrade, but not AES-KDF. With these changes we would never notice.
There was a problem hiding this comment.
This does not actually use Argon2, but iff Argon2 is used, then the parameters are applied. AesKdf ignores these, but the cipher is not changed.
There was a problem hiding this comment.
Actually, thinking more about it... You are just setting the parameters and not changing the actual KDF. But I would still prefer you add a check here.
* Tests: Speed up AutoType testing Decrease default autotype delay to 1 to improve test suite speed by seconds. This shaves multiple seconds off the whole test suite. In some cases, the largest part. Also, initialize config just creating the test instance, just in case that it ever depends on the configuration values at that point already. * Tests: Speed up Kdbx4 testing This speeds up the Kdbx4 tests by using parameters optimized for speed for the key derivation functions. On an i7-6700K the tests run close to 50% faster with this change (about 1.5s vs. 3s).
Description
This speeds up the slowest tests, AutoType and Kdbx4, by adjusting some parameters which should not influence the tested semantics.
Motivation and context
Tests are slow. It's more fun to write code with faster test suites.
How has this been tested?
I ran tests on Debian GNU/Linux on an i7-6700K with ASAN on and off. The times went down from approximately 9.71s and 8.72s respectively to 4.38s and 3.08s for a
make test.TestKdbx4is still slow (still lots of cryptography), butTestAutoTypeis almost negligible.Types of changes
Checklist:
-DWITH_ASAN=ON. [REQUIRED]