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

io: remove redundant check #6966

Merged
merged 4 commits into from
Nov 21, 2024
Merged

io: remove redundant check #6966

merged 4 commits into from
Nov 21, 2024

Conversation

nurmohammed840
Copy link
Contributor

@nurmohammed840 nurmohammed840 commented Nov 10, 2024

Removes a redundant checks:

1. No need to unpack readiness, Since readiness is already positioned at the least significant portion, And Ready::from_usize performs internal masking
2. Remove if !existing.will_wake { .. }, Since waker.clone_from already performs this optimization internally.
3. Updated fn set_readiness(), to skip calling the closure f(..) when possible.

@Darksonn
Copy link
Contributor

Since readiness is already positioned at the least significant portion, And Ready::from_usize performs internal masking

That seems really fragile. I would say that keeping the unpacking is better.

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, thanks! Just one more nit:

tokio/src/runtime/io/scheduled_io.rs Outdated Show resolved Hide resolved
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-io Module: tokio/io labels Nov 13, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit c07257f into tokio-rs:master Nov 21, 2024
81 checks passed
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Dec 4, 2024
Bumps tokio from 1.41.1 to 1.42.0.

Release notes
Sourced from tokio's releases.

Tokio v1.42.0
1.42.0 (Dec 3rd, 2024)
Added

io: add AsyncFd::{try_io, try_io_mut} (#6967)

Fixed

io: avoid ptr->ref->ptr roundtrip in RegistrationSet (#6929)
runtime: do not defer yield_now inside block_in_place (#6999)

Changes

io: simplify io readiness logic (#6966)

Documented

net: fix docs for tokio::net::unix::{pid_t, gid_t, uid_t} (#6791)
time: fix a typo in Instant docs (#6982)

#6791: tokio-rs/tokio#6791
#6929: tokio-rs/tokio#6929
#6966: tokio-rs/tokio#6966
#6967: tokio-rs/tokio#6967
#6982: tokio-rs/tokio#6982
#6999: tokio-rs/tokio#6999



Commits

bb9d570 chore: prepare Tokio v1.42.0 (#7005)
af9c683 tests: fix typo in build test instructions (#7004)
4bc5a1a ci: allow Unicode-3.0 license for unicode-ident (#7006)
f8948ea runtime: do not defer yield_now inside block_in_place (#6999)
bce9780 time: use array::from_fn instead of manually creating array (#7000)
38151f3 readme: unlist 1.32.x as LTS release (#6997)
5dda72d ci: pin valgrind to rustc 1.82 (#6998)
c07257f io: simplify io readiness logic (#6966)
d08578f time: fix a typo in Instant docs (#6982)
4047d79 miri: add annotations for tests with miri ignore (#6981)
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-io Module: tokio/io
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants