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

eliminate boxing in RequesterResponderSupport when using IntObjectMap #1029

Merged
merged 1 commit into from
Nov 13, 2021

Conversation

ghost
Copy link

@ghost ghost commented Nov 12, 2021

IntObjectMap implements Map and as so it has methods:

Those declarations uses Object for keys, and not specified for usage of int primitive as key, and as so it autobox them.

@ghost ghost force-pushed the eliminate-boxing branch from 32332b9 to 0f93595 Compare November 12, 2021 07:06
Copy link
Member

@OlegDokuka OlegDokuka left a comment

Choose a reason for hiding this comment

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

LGTM with minor suggestion

Comment on lines 122 to 128
final IntObjectMap<FrameHandler> activeStreams = this.activeStreams;
// copy of Map.putIfAbsent(key, value) without `streamId` boxing
FrameHandler previousHandler = activeStreams.get(streamId);
if (previousHandler == null) {
previousHandler = activeStreams.put(streamId, frameHandler);
}
return previousHandler == null;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
final IntObjectMap<FrameHandler> activeStreams = this.activeStreams;
// copy of Map.putIfAbsent(key, value) without `streamId` boxing
FrameHandler previousHandler = activeStreams.get(streamId);
if (previousHandler == null) {
previousHandler = activeStreams.put(streamId, frameHandler);
}
return previousHandler == null;
final IntObjectMap<FrameHandler> activeStreams = this.activeStreams;
// copy of Map.putIfAbsent(key, value) without `streamId` boxing
FrameHandler previousHandler = activeStreams.get(streamId);
if (previousHandler == null) {
activeStreams.put(streamId, frameHandler);
return true;
}
return false;

Copy link
Author

Choose a reason for hiding this comment

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

thx, done

@ghost ghost force-pushed the eliminate-boxing branch from 0f93595 to e5818e1 Compare November 12, 2021 13:09
@OlegDokuka OlegDokuka merged commit 16fdb87 into rsocket:master Nov 13, 2021
@ghost ghost deleted the eliminate-boxing branch November 15, 2021 06:18
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