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

Don't provide promises when we don't care about results. #437

Merged
merged 1 commit into from
May 24, 2018

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented May 24, 2018

Motivation:

When we don't care about the result of an operation, we shouldn't provide
a promise.

While I'm here I also removed an unnecessary close() call in the
AcceptHandler: the close() would be called again almost immediately.

Modifications:

Removed a close() call.
Set promise: nil on a pair of close() calls.

Result:

Fewer promise allocations.

Motivation:

When we don't care about the result of an operation, we shouldn't provide
a promise.

While I'm here I also removed an unnecessary close() call in the
AcceptHandler: the close() would be called again almost immediately.

Modifications:

Removed a close() call.
Set `promise: nil` on a pair of close() calls.

Result:

Fewer promise allocations.
@Lukasa Lukasa added the semver/patch No public API change. label May 24, 2018
@Lukasa Lukasa added this to the 1.7.2 milestone May 24, 2018
Copy link
Member

@weissi weissi left a comment

Choose a reason for hiding this comment

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

thanks Cory, that looks good!

@weissi weissi merged commit 77dc77b into apple:master May 24, 2018
@weissi
Copy link
Member

weissi commented May 24, 2018

@Lukasa just as a question: This should allocate fewer promises, right? Did you check the allocation limits? Sorry should've asked that earlier but maybe we can do that post 1.7.2

@Lukasa
Copy link
Contributor Author

Lukasa commented May 24, 2018

I think this promise removal was only on error paths, so it shouldn’t have affected our tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants