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

Fixed KAI.AnnotatedParameter.hasRequiredMarker and KNAI.findKotlinParameterName to refer to ReflectionCache #543

Closed
wants to merge 2 commits into from

Conversation

k163377
Copy link
Contributor

@k163377 k163377 commented Jan 16, 2022

KAI.AnnotatedParameter.hasRequiredMarker and KNAI.findKotlinParameterName get the kotlinFunction directly without referring to the ReflectionCache.
On the other hand, the Java Constructor/Java Method referenced by these functions is the same as the one referenced by KVI, so I have improved it by referencing the ReflectionCache.

TODO: Add benchmark result.

Also, to resolve #199 and #413, we need to fix the process of getting a KFunction from a Java Constructor.
This fix is easier if the calls to Constructor<Any>.kotlinFunction are centralized in a ReflectionCache.
The above is accomplished with this PR.

What did not fix in this PR.

KAI.Method.getRequiredMarkerFromAccessorLikeMethod also calls kotlinFunction, but it is not modified to reference ReflectionCache.
I did not modify it because I was concerned that this change would slow down deserialization.

The ReflectionCache.kotlinFromJava(Constructor or Method) is specifically referenced during deserialization.
If it is also referenced during serialization, the cache hit rate during deserialization may decrease, and as a result, the speed of deserialization may decrease.
I have not yet verified whether this concern actually occurs, so I would like to ask whether it should be included in this PR.

@k163377
Copy link
Contributor Author

k163377 commented Jan 16, 2022

I tested the performance and found that, contrary to my expectations, this change seems to slow down the deserialization process.
The use of ReflectionCache may need to be considered.
I'll close this PR.

@k163377 k163377 closed this Jan 16, 2022
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