-
Notifications
You must be signed in to change notification settings - Fork 784
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
Use linked list in ReleasePool #281
Conversation
The 1st commit is naive |
Benchmark result:
LinkedList<NonNull>(after: 1)
LinkedList<[NonNull<_>; 256>(after: 2)
LinkedList<[NonNull<_>; 512]>(Not pushed)
(Arch Linux 4.18.16, rustc 1.32.0-nightly (25a42b2ce 2018-11-07), Intel Core i5-6500) |
// release py objects | ||
for ptr in vec.iter_mut() { | ||
// release PyObjects | ||
for ptr in vec.iter() { | ||
ffi::Py_DECREF(ptr.as_ptr()); |
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.
Filed #282 because this is lurking UB
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.
Big thanks for tackling this!
I wonder if there's a performance overhead in using a vec or zero-initialization. This would allow us to avoid mem::uninitialized()
@konstin
Vec built by
(Ubuntu 17.10 + AMD Ryzen 5 1600) |
Thanks for measuring, we now have a good rationale for keeping |
Fix #271
I haven't benched yet and maybe
LinkedList<[NonNull<_>; 256]
or so is more efficient