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

olme04
Copy link
Contributor

@olme04 olme04 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.

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
Contributor Author

Choose a reason for hiding this comment

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

thx, done

@OlegDokuka OlegDokuka merged commit 16fdb87 into rsocket:master Nov 13, 2021
@olme04 olme04 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.

2 participants