Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JNI/JSSE: optimize out array creation in WolfSSLEngine RecvAppData() #244

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

cconlon
Copy link
Member

@cconlon cconlon commented Dec 23, 2024

This is an optimization PR that removes an extra byte[] array creation inside WolfSSLEngine.RecvAppData(), which is called from SSLEngine.unwrap().

Prior to this PR, we allocated a new byte[] to read ByteBuffer data into and pass down to JNI for SSL_read() operations.

This PR changes that behavior so that if there is only one ByteBuffer in the output ByteBuffer[] passed to unwrap(), that ByteBuffer is passed down to JNI directly where the underlying array is retrieved and used without an extra array creation.

This should have positive impacts on reducing the number of objects created, especially in use cases where lots of data is being received (or downloaded) via an SSLEngine.unwrap() interface.

@cconlon cconlon force-pushed the sslEngineOptimization branch from 2c6868c to 12eae28 Compare January 6, 2025 23:22
@JacobBarthelmeh JacobBarthelmeh merged commit 63052de into wolfSSL:master Jan 6, 2025
45 checks passed
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.

3 participants