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

Bump MSRV to 1.47, reduce size of sys::Events #40

Merged
merged 2 commits into from Aug 21, 2022
Merged

Bump MSRV to 1.47, reduce size of sys::Events #40

merged 2 commits into from Aug 21, 2022

Conversation

taiki-e
Copy link
Collaborator

@taiki-e taiki-e commented Aug 21, 2022

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).

@@ -221,7 +221,7 @@ impl Events {
data: 0,
udata: 0 as _,
};
let list = vec![ev; 1000].into_boxed_slice();
Copy link
Collaborator Author

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.

Copy link
Member

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]);
Copy link
Collaborator Author

@taiki-e taiki-e Aug 21, 2022

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

@taiki-e taiki-e requested review from notgull and zeenix August 21, 2022 12:26
@taiki-e taiki-e changed the title Bump MSRV to 1.47 Bump MSRV to 1.47, reduce size of sys::Events Aug 21, 2022
Copy link
Member

@notgull notgull left a 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!

@taiki-e taiki-e merged commit de312d1 into master Aug 21, 2022
@taiki-e taiki-e deleted the rust-1.47 branch August 21, 2022 14:40
@taiki-e taiki-e mentioned this pull request Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Smaller Events representation
3 participants