Skip to content

Conversation

@mkeskells
Copy link

@mkeskells mkeskells commented Dec 17, 2025

Issue #, if available:
No
Description of changes:
Pool usages of Cipher.getInstance when used for CipherHandler

In my (closed source) benchmark

  • in decryption this call accounts for 38% of CPU usage and 10% of object allocations
  • in encryption this call accounts for slightly less - 33% of CPU and 10% of allocations

This is POC code for comment. I am presuming the maintainers will have opinions on cache type/configuration, and refinements to the idea

In most usages the CipherHandler is created, used and thrown away, but seems to be reused for the framed access, so some rework is probably needed there. Opinions welcome

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@mkeskells mkeskells requested a review from a team as a code owner December 17, 2025 02:28
@mkeskells mkeskells changed the title avoid expensive call to Cipher.getInstance feat: avoid expensive call to Cipher.getInstance Dec 18, 2025
@mkeskells mkeskells changed the title feat: avoid expensive call to Cipher.getInstance perf: avoid expensive call to Cipher.getInstance Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant