Skip to content

Performance improvements for SymmetricAlgorithm one-shots #55601

@vcsjones

Description

@vcsjones

With #2406 merged, we got the basic API shape in and functioning. As follow up work, there are a few places we can optimize for better performance:

  • Skip the Reset after performing a one-shot operation. Since it's only used one time, there is no point of performing a reset right before it gets disposed.
  • Skip allocating an IV when possible.
    Unix and macOS don't need a copy of the IV since it's only used during initialization and their native APIs create copy themselves for internal use when performing update / final.
    Windows requires passing the IV to each call, expecting the callers to track the IV between updates. But we don't need to support transferring this between calls to update, so it can be stack allocated.
  • Cache algorithm instance handles but remain thread safe. We could store the handles in a ThreadLocal or similar.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions