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

Avoid duplicate calls to getParameterTypes and getGenericParameterTypes #21794

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

Postremus
Copy link
Member

Calling getParameterTypes or getGenericParameterTypes creates clones of the underlying arrays.
Doing so during iterations is costly, so lets better not do that.

This again saves saves a few ms. I saw both of these calls at "0,8% of all" according to the flamegraphs.

Related to #21552

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 29, 2021

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should preferably start with an uppercase character (if it makes sense!)

This message is automatically generated by a bot.

@Postremus Postremus changed the title avoid duplicate calls to getParameterTypes and getGenericParameterTypes Avoid duplicate calls to getParameterTypes and getGenericParameterTypes Nov 29, 2021
@Postremus
Copy link
Member Author

Will have to rebase these changes, apperantly more was included in the commit then I originally intended.

@Postremus Postremus force-pushed the less-array-clones branch 2 times, most recently from c86f160 to 954c523 Compare November 29, 2021 17:53
@quarkus-bot
Copy link

quarkus-bot bot commented Nov 29, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

Failing Jobs - Building 67ba867

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Failures Logs Raw logs
Initial JDK 11 Build ⚠️ Check → Logs Raw logs
Attach pull request number ⚠️ Check → Logs Raw logs
CI Sanity Check ⚠️ Check → Logs Raw logs

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 29, 2021

This workflow status is outdated as a new workflow run has been triggered.

🚫 This workflow run has been cancelled.

Failing Jobs - Building c86f160

⚠️ Artifacts of the workflow run were not available thus the report misses some details.

Status Name Step Failures Logs Raw logs
Initial JDK 11 Build ⚠️ Check → Logs Raw logs
Attach pull request number ⚠️ Check → Logs Raw logs
CI Sanity Check ⚠️ Check → Logs Raw logs

@Postremus
Copy link
Member Author

This is now ready for review.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

Overall, this looks very good. I added a small comment about synchronization in a RESTEasy Reactive class. @geoand would know more for sure.

@@ -102,8 +103,10 @@ public Method getResourceMethod() {
}

public Annotation[] getParameterAnnotations(int index) {
// Should we cache this?
return getMethod().getParameterAnnotations()[index];
if (parameterAnnotations == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Given how getMethod() looks in the same class, there's a good chance this might need a synchronization pattern.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'd say let's just skip the change to this method.

Copy link
Member

Choose a reason for hiding this comment

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

@Postremus could you revert this specific change and squash? After that I think it's good to go.

Copy link
Member Author

Choose a reason for hiding this comment

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

@gsmet I will do a squash & rebase this evening (CEST).

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Calling getParameterTypes or getGenericParameterTypes creates clones of the underlying arrays.
Doing so during iterations is costly, so lets better not do that.
@gsmet gsmet added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Nov 30, 2021
@geoand geoand merged commit 68b9b03 into quarkusio:main Dec 1, 2021
@quarkus-bot quarkus-bot bot added this to the 2.6 - main milestone Dec 1, 2021
@quarkus-bot quarkus-bot bot removed the triage/waiting-for-ci Ready to merge when CI successfully finishes label Dec 1, 2021
@Postremus Postremus deleted the less-array-clones branch December 2, 2021 06:54
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