-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Specialize some methods of io::Chain
#105917
Conversation
r? @m-ou-se (rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
This comment has been minimized.
This comment has been minimized.
bb16dd8
to
57718e5
Compare
If you resolved all issues brought up in the review, you should use the bot to mark it as waiting-on-review |
@rustbot label -S-waiting-on-author +S-waiting-on-review |
I didn't know I can do that myself ! Thanks ! |
I have removed |
Are you able to run a quick benchmark that shows this being faster? I'm positive it will be faster, but it never hurts to have something to back up added complexity for the sake of performance. We could do a perf run on this in any case, but I don't expect this change to be exercised much in that run. (side note, |
Looks good. Can you do the squishy-squishy for the last two commits? r? workingjubilee |
I don't think there's a single instance of this type in the compiler? |
Mostly it's confusing to see a commit that introduces something and then immediately see its removal while navigating the repo's history, so it's just noise in the blame. |
dfbcdcd
to
ebc5970
Compare
Making sure I get to this soon. |
#[inline] | ||
fn is_read_vectored(&self) -> bool { | ||
self.first.is_read_vectored() || self.second.is_read_vectored() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this require both to be efficient? I could be persuaded otherwise, certainly, but can you explain why you chose this logic instead? If one half of the chain doesn't have an efficient implementation, then why is the chained type efficient? At the extreme end, we're allowed to apply Chain recursively, so this version you propose would yield true
even if we'd chained 16 different things together and only 1 reported true
...
#[inline] | |
fn is_read_vectored(&self) -> bool { | |
self.first.is_read_vectored() || self.second.is_read_vectored() | |
} | |
#[inline] | |
fn is_read_vectored(&self) -> bool { | |
self.first.is_read_vectored() & self.second.is_read_vectored() | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you could also use a more complicated answer which checks done_first
, but that seems prone to confusion, even if it might be "more accurate".
Waiting on discussion a bit, so |
Also, I can accept this as-is without the |
ping from triage - can you post your status on this PR? There hasn't been an update in month - you seem close to getting this into a mergable state. FYI: when a PR is ready for review, send a message containing |
Well there is debate over the implementation of I initially used |
Indeed. I'm not entirely sure what the rationale is for the |
I'm happy to be persuaded? It just doesn't feel obvious atm. |
Well, the rationale is mostly the same: if we chain 16 types and only one returns The main difference is that vectored I/O can significantly improve perf, but has a small cost when used with a single buffer (a indirection on the stack). This is why WASI doesn't have an equivalent of So even with half the chain not vectored, having vectored I/O for the other is usually interesting. |
Hmm. I see. WASI only providing @bors r+ |
☀️ Test successful - checks-actions |
1 similar comment
☀️ Test successful - checks-actions |
Finished benchmarking commit (bea5beb): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 640.888s -> 640.916s (0.00%) |
This PR specializes the implementation of some methods of
io::Chain
, which could bring performance improvements when using it.