Skip to content

Commit 67c954e

Browse files
committed
auto merge of #8566 : toddaaro/rust/idle-opt+cleaning, r=catamorphism,brson
Instead of a furious storm of idle callbacks we just have one. This is a major performance gain - around 40% on my machine for the ping pong bench. Also in this PR is a cleanup commit for the scheduler code. Was previously up as a separate PR, but bors load + imminent merge hell led me to roll them together. Was #8549.
2 parents 7f26812 + e5ccf13 commit 67c954e

File tree

6 files changed

+386
-302
lines changed

6 files changed

+386
-302
lines changed

src/libstd/rt/rtio.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,25 @@ pub type RtioTcpStreamObject = uvio::UvTcpStream;
2424
pub type RtioTcpListenerObject = uvio::UvTcpListener;
2525
pub type RtioUdpSocketObject = uvio::UvUdpSocket;
2626
pub type RtioTimerObject = uvio::UvTimer;
27+
pub type PausibleIdleCallback = uvio::UvPausibleIdleCallback;
2728

2829
pub trait EventLoop {
2930
fn run(&mut self);
3031
fn callback(&mut self, ~fn());
32+
fn pausible_idle_callback(&mut self) -> ~PausibleIdleCallback;
3133
fn callback_ms(&mut self, ms: u64, ~fn());
3234
fn remote_callback(&mut self, ~fn()) -> ~RemoteCallbackObject;
3335
/// The asynchronous I/O services. Not all event loops may provide one
3436
fn io<'a>(&'a mut self) -> Option<&'a mut IoFactoryObject>;
3537
}
3638

3739
pub trait RemoteCallback {
38-
/// Trigger the remote callback. Note that the number of times the callback
39-
/// is run is not guaranteed. All that is guaranteed is that, after calling 'fire',
40-
/// the callback will be called at least once, but multiple callbacks may be coalesced
41-
/// and callbacks may be called more often requested. Destruction also triggers the
42-
/// callback.
40+
/// Trigger the remote callback. Note that the number of times the
41+
/// callback is run is not guaranteed. All that is guaranteed is
42+
/// that, after calling 'fire', the callback will be called at
43+
/// least once, but multiple callbacks may be coalesced and
44+
/// callbacks may be called more often requested. Destruction also
45+
/// triggers the callback.
4346
fn fire(&mut self);
4447
}
4548

0 commit comments

Comments
 (0)