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

fix(jsii-pacmak): improve struct performance in Java #4140

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jun 9, 2023

When a struct is returned to Java, it gets returned by reference. The Java struct proxy then proceeds to read all fields from the struct, even if they are never used by the Java program.

Make this behavior on-demand with a cache: the value is read if it is requested, but will never be read more than once (this is fine as structs are immutable).

If we decide to pass the struct back into jsii, we can avoid having to read all the fields at that point to build a fresh struct if we hold on to the struct reference and pass that back in.


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

When a struct is returned to Java, it gets returned by reference. The
Java struct proxy then proceeds to read all fields from the struct, even
if they are never used by the Java program.

Make this behavior on-demand with a cache: the value is read if it is
requested, but will never be read more than once (this is fine as
structs are immutable).

If we decide to pass the struct back into jsii, we can avoid having
to read all the fields at that point to build a fresh struct if we
hold on to the struct reference and pass that back in.
@rix0rrr rix0rrr requested a review from a team June 9, 2023 13:29
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants