Add a really optimistic fast path in receive. Gives about a 7% performance improvement in msgsend-ring-pipes
This commit is contained in:
parent
bc6ba6b091
commit
c5fbff01ce
@ -395,6 +395,20 @@ fn try_recv<T: send, Tbuffer: send>(-p: recv_packet_buffered<T, Tbuffer>)
|
|||||||
{
|
{
|
||||||
let p_ = p.unwrap();
|
let p_ = p.unwrap();
|
||||||
let p = unsafe { &*p_ };
|
let p = unsafe { &*p_ };
|
||||||
|
|
||||||
|
// optimistic path
|
||||||
|
match p.header.state {
|
||||||
|
full => {
|
||||||
|
let mut payload = none;
|
||||||
|
payload <-> p.payload;
|
||||||
|
p.header.state = empty;
|
||||||
|
return some(option::unwrap(payload))
|
||||||
|
},
|
||||||
|
terminated => return none,
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// regular path
|
||||||
let this = rustrt::rust_get_task();
|
let this = rustrt::rust_get_task();
|
||||||
rustrt::task_clear_event_reject(this);
|
rustrt::task_clear_event_reject(this);
|
||||||
rustrt::rust_task_ref(this);
|
rustrt::rust_task_ref(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user