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

Make minor improvements to various RESTEasy Reactive classes that iterate through maps #18102

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Jun 23, 2021

We remove the use of entrySet() where it makes sense and replace it with forEach()
which faster and doesn't allocate additional objects

…rate through maps

We remove the use of entrySet() where it makes sense and replace it with forEach
which faster and doesn't allocate additional objects
@geoand
Copy link
Contributor Author

geoand commented Jun 23, 2021

Something @Sanne would likely enjoy :)

Copy link
Member

@Sanne Sanne left a comment

Choose a reason for hiding this comment

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

I love that you're looking at such optimisation opportunities :) alas it's not complete.

@@ -185,7 +185,7 @@ public AbstractResponseBuilder clone() {
responseBuilder.status = status;
responseBuilder.reasonPhrase = reasonPhrase;
responseBuilder.entity = entity;
responseBuilder.metadata = new QuarkusMultivaluedHashMap<>();
responseBuilder.metadata = new CaseInsensitiveMap<>();
Copy link
Member

Choose a reason for hiding this comment

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

How does this relate with the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's necessary in order to narrow the type of the map - it should have been done anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also see my comment below

@geoand geoand requested a review from Sanne June 23, 2021 13:33
@geoand
Copy link
Contributor Author

geoand commented Jun 23, 2021

I love that you're looking at such optimisation opportunities :)

It's great to be able to learn of such opportunities from the experts :)

return stringHeaders;
}

public void populateStringHeaders(String headerName, List<Object> values) {
List<String> stringValues = new ArrayList<>(values.size());
Copy link
Member

Choose a reason for hiding this comment

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

I know it's not related to this PR, but allocating arrayslists in a tight loop for no other reason than to accomodate for the put method requirements ?! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm open to suggestions :)

@Sanne Sanne merged commit 6744012 into quarkusio:main Jun 23, 2021
@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone Jun 23, 2021
@geoand geoand deleted the rr-minor-polish branch June 23, 2021 13:43
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.

None yet

2 participants