Skip to content

Conversation

Puppy4C
Copy link

@Puppy4C Puppy4C commented Jan 18, 2025

The signature of Interceptor is static, and I think it should be cached, otherwise every time an operation is performed, a new one will be created, which is a time-consuming operation.

}

private static Map<Class<?>, Set<Method>> getSignatureMap(Interceptor interceptor) {
return signatureMapCache.computeIfAbsent(interceptor.getClass(), (clazz) -> createSignatureMap(interceptor));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest changing it to org.apache.ibatis.util.MapUtil#computeIfAbsent

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it seemed that this method did not exist at the time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3372

@harawata
Copy link
Member

Thank you for the PR, @Puppy4C !

I did some tests and the effect of this PR was not significant (see the benchmark result).
Unless there is some issue with my benchmark code/config, I consider this to be a "premature optimization" and will close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants