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
Bump MSRV to 1.47, reduce size of sys::Events #40
Conversation
@@ -221,7 +221,7 @@ impl Events { | |||
data: 0, | |||
udata: 0 as _, | |||
}; | |||
let list = vec![ev; 1000].into_boxed_slice(); |
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'm not sure why the old code used 1000 instead of 1024.
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.
It would be a mis-optimization, if I had to guess.
@@ -289,7 +289,7 @@ impl Events { | |||
/// Creates an empty list. | |||
pub fn new() -> Events { | |||
let ev = libc::epoll_event { events: 0, u64: 0 }; | |||
let list = vec![ev; 1000].into_boxed_slice(); | |||
let list = Box::new([ev; 1024]); |
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 didn't do it on this patch, but calling alloc_zeroed via unsafe code is probably best from a point of view of performance.
https://godbolt.org/z/T1e8ETv61 https://godbolt.org/z/hcss6hEaT https://godbolt.org/z/fG9ddPsdq
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.
Looks good to me!
libc
plans to raise their MSRV to 1.47 (rust-lang/libc#2845), and some crates of smol-rs also require 1.47 since async-task 4.3.0 (smol-rs/async-task#30). It seems to be a reasonable time to do #19.This also reduces the size of
sys::Events
(closes #19).