Repository navigation
perf: reuse one Mac per HKDF instance - #2193
sharmabikram wants to merge 1 commit into
Conversation
|
Hi @sharmabikram In performance test the 2 calls to getInstance (for the Mac in #2174 and Cypher in #2175) account for 45% of the CPU in our production based test cases. Clearly the test basis is likely different but we should at least compare notes on the optimistions available. I cant share the original test cases, but I am happy to work on a clean test case that we can use to benchmark There is write access available to the original PR. I would hope that we could build a full solution rather than extracting bits of one PR and making another |
Issue #, if available:
Description of changes:
Why
Every message that uses an HKDF or key committing algorithm suite creates several Mac objects just to derive its keys. With the default committing suite that is four per message. Creating a Mac has a real cost on small payloads, as reported in #2174.
What this PR does
The public API does not change, and nothing is cached between instances. A provider registered later is still picked up.
What to review
Testing
Thanks to @mkeskells for finding this in #2174.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Check any applicable: