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

Optimize set_non_blocking: Avoid dup mono #955

Closed
wants to merge 2 commits into from
Closed

Optimize set_non_blocking: Avoid dup mono #955

wants to merge 2 commits into from

Conversation

NobodyXu
Copy link
Collaborator

set_non_blocking takes a generic parameter and it is used in two different places with different types.

Since it only uses the fd returned by pipe.as_raw_fd(), we could create an _inner function that takes the fd and do the job.

@NobodyXu NobodyXu mentioned this pull request Feb 20, 2024
@Amanieu
Copy link
Member

Amanieu commented Feb 20, 2024

Does this even make a noticeable impact? This is a single function that is only monomorphized twice, it's not like HashMap which has many methods and can be monomorphized for thousands of different types.It makes the code harder to read on the other hand.

@NobodyXu
Copy link
Collaborator Author

It probably won't have much effect and I'm just being pedantic.

Though it really doesn't hurt, the code is quite simple and the change would make sure future use of it won't cause more monomorphisation.

@Amanieu
Copy link
Member

Amanieu commented Feb 20, 2024

Even if there are a few more monomorphizations, the impact of compiling one extra monomorphizationwill be unnoticeable. I'm still inclined not to merge this.

@NobodyXu
Copy link
Collaborator Author

Got it, I will close this as not planned.

@NobodyXu NobodyXu closed this Feb 20, 2024
@NobodyXu NobodyXu deleted the optimize branch February 20, 2024 13:32
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